UNPKG

@flexilla/manager

Version:

Utility that help manage Flexilla Components Instances

2 lines (1 loc) 749 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class n{static initGlobalRegistry(){window.$flexillaInstances||(window.$flexillaInstances={})}static register(i,l,t){this.initGlobalRegistry(),window.$flexillaInstances[i]||(window.$flexillaInstances[i]=[]);const s=this.getInstance(i,l);return s||(window.$flexillaInstances[i].push({element:l,instance:t}),t)}static getInstance(i,l){var t,s;return this.initGlobalRegistry(),(s=(t=window.$flexillaInstances[i])==null?void 0:t.find(e=>e.element===l))==null?void 0:s.instance}static removeInstance(i,l){this.initGlobalRegistry(),window.$flexillaInstances[i]&&(window.$flexillaInstances[i]=window.$flexillaInstances[i].filter(t=>t.element!==l))}}exports.FlexillaManager=n;