UNPKG

394 BJavaScriptView Raw
1(function (root) {
2 'use strict';
3
4 // set the storage item so any subsequent calls to .setItem will trigger
5 // the DOMStorage.domStorageItemUpdated event in lib/event-bus.js
6 window.localStorage.setItem('bus', '');
7
8 root._eventbus = {
9 emit (name, data = '') {
10 let json = JSON.stringify({ name, data });
11
12 window.localStorage.setItem('bus', json);
13 }
14 };
15
16})(window);