UNPKG

comindware.core.ui

Version:

Comindware Core UI provides the basic components like editors, lists, dropdowns, popups that we so desperately need while creating Marionette-based single-page applications.

21 lines (17 loc) 576 B
import Backbone from 'backbone'; export default class CTEventsService { static initialize() { window.addEventListener('storage', event => { if (event.key === 'cbEvent') { this.__handleStorageEvent(event.newValue); } }); Object.assign(this, Backbone.Events); } static triggerStorageEvent(eventId, data) { localStorage.setItem('cbEvent', JSON.stringify({ id: eventId, data })); } static __handleStorageEvent(newValue) { this.trigger('cbEvent', JSON.parse(newValue)); } }