UNPKG

@flexilla/manager

Version:

Utility that help manage Flexilla Components Instances

25 lines (24 loc) 830 B
class a { static initGlobalRegistry() { window.$flexillaInstances || (window.$flexillaInstances = {}); } static register(i, l, s) { this.initGlobalRegistry(), window.$flexillaInstances[i] || (window.$flexillaInstances[i] = []); const t = this.getInstance(i, l); return t || (window.$flexillaInstances[i].push({ element: l, instance: s }), s); } static getInstance(i, l) { var s, t; return this.initGlobalRegistry(), (t = (s = window.$flexillaInstances[i]) == null ? void 0 : s.find( (n) => n.element === l )) == null ? void 0 : t.instance; } static removeInstance(i, l) { this.initGlobalRegistry(), window.$flexillaInstances[i] && (window.$flexillaInstances[i] = window.$flexillaInstances[i].filter( (s) => s.element !== l )); } } export { a as FlexillaManager };