UNPKG

@textback/notification-widget

Version:

TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.

29 lines (22 loc) 633 B
const storage = {}; function setWidget(widgetId, widgetPromise) { storage[widgetId] = storage[widgetId] || {}; storage[widgetId].promise = widgetPromise; } function getWidget(widgetId) { return storage[widgetId] ? storage[widgetId].promise : null; } function setVkHandler(widgetId, handler) { storage[widgetId] = storage[widgetId] || {}; storage[widgetId].vkHandler = handler; } function getVkHandler(widgetId) { return storage[widgetId] ? storage[widgetId].vkHandler : null; } const widgetsStorage = { setWidget, getWidget, setVkHandler, getVkHandler, }; export default widgetsStorage;