UNPKG

wormhole.js

Version:

Wormhole - is EventEmitter for communication between tabs.

28 lines (24 loc) 503 B
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <script src="./wormhole.js"></script> <script> (function (cors, store) { cors.register = function (data, source) { var port = cors(source); store.on('change', function (key, data) { port.send({ key: key, data: data, }); }); return store.getAll(); }; cors.store = function (data) { store[data.cmd](data.key, data.value); }; })(wormhole.cors, wormhole.store); </script> </head> </html>