An event emitter for communication between tabs using service worker.
-
add
docs/index.bundle.js
in script<script src="./index.bundle.js"></script>
-
open two tabs of the page and run these commands in console:
swe.on('test', console.log);
swe.emit('test', 'just a test.');
-
swe.on(eventName, listener)
-
swe.once(eventName, listener)
-
swe.emit(eventName, payload0, payload1, payload2, ...)
-
swe.remove(eventName, listener)
-
swe.removeAll(eventName)
run npm run build && npm run test
Open multi demo page and click the benchmark start button.