All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.prod.FeaturesRegistry.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../src/FeaturesRegistry.ts"],
  "sourcesContent": ["import EventProvider from \"./EventProvider.js\";\nimport type UI5Element from \"./UI5Element.js\";\n\nabstract class ComponentFeature {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-function\n\tconstructor(...args: any[]) {}\n\tstatic define?: () => Promise;\n\tstatic dependencies?: Array\n}\n\nconst features = new Map();\nconst componentFeatures = new Map();\nconst subscribers = new Map>();\n\nconst EVENT_NAME = \"componentFeatureLoad\";\nconst eventProvider = new EventProvider();\n\nconst featureLoadEventName = (name: string) => `${EVENT_NAME}_${name}`;\n\nconst registerFeature = (name: string, feature: object) => {\n\tfeatures.set(name, feature);\n};\n\nconst getFeature = (name: string): T => {\n\treturn features.get(name) as T;\n};\n\nconst registerComponentFeature = async (name: string, feature: typeof ComponentFeature) => {\n\tawait Promise.all(feature.dependencies?.map(dep => dep.define()) || []);\n\tawait feature.define?.();\n\n\tcomponentFeatures.set(name, feature);\n\tnotifyForFeatureLoad(name);\n};\n\nconst getComponentFeature = (name: string): T => {\n\treturn componentFeatures.get(name) as T;\n};\n\nconst subscribeForFeatureLoad = (name: string, klass: typeof UI5Element, callback: () => void) => {\n\tconst subscriber = subscribers.get(klass);\n\tconst isSubscribed = subscriber?.includes(name);\n\n\tif (isSubscribed) {\n\t\treturn;\n\t}\n\n\tif (!subscriber) {\n\t\tsubscribers.set(klass, [name]);\n\t} else {\n\t\tsubscriber.push(name);\n\t}\n\n\teventProvider.attachEvent(featureLoadEventName(name), callback);\n};\n\nconst notifyForFeatureLoad = (name: string) => {\n\teventProvider.fireEvent(featureLoadEventName(name), undefined);\n};\n\nexport {\n\tregisterFeature,\n\tgetFeature,\n\tregisterComponentFeature,\n\tgetComponentFeature,\n\tsubscribeForFeatureLoad,\n\tComponentFeature,\n};\n"],
  "mappings": "aAAA,OAAOA,MAAmB,qBAG1B,MAAeC,CAAiB,CAE/B,eAAeC,EAAa,CAAC,CAG9B,CAEA,MAAMC,EAAW,IAAI,IACfC,EAAoB,IAAI,IACxBC,EAAc,IAAI,IAElBC,EAAa,uBACbC,EAAgB,IAAIP,EAEpBQ,EAAwBC,GAAiB,GAAGH,CAAU,IAAIG,CAAI,GAE9DC,EAAkB,CAACD,EAAcE,IAAoB,CAC1DR,EAAS,IAAIM,EAAME,CAAO,CAC3B,EAEMC,EAAiBH,GACfN,EAAS,IAAIM,CAAI,EAGnBI,EAA2B,MAAOJ,EAAcE,IAAqC,CAC1F,MAAM,QAAQ,IAAIA,EAAQ,cAAc,IAAIG,GAAOA,EAAI,OAAO,CAAC,GAAK,CAAC,CAAC,EACtE,MAAMH,EAAQ,SAAS,EAEvBP,EAAkB,IAAIK,EAAME,CAAO,EACnCI,EAAqBN,CAAI,CAC1B,EAEMO,EAA0BP,GACxBL,EAAkB,IAAIK,CAAI,EAG5BQ,EAA0B,CAACR,EAAcS,EAA0BC,IAAyB,CACjG,MAAMC,EAAaf,EAAY,IAAIa,CAAK,EACnBE,GAAY,SAASX,CAAI,IAMzCW,EAGJA,EAAW,KAAKX,CAAI,EAFpBJ,EAAY,IAAIa,EAAO,CAACT,CAAI,CAAC,EAK9BF,EAAc,YAAYC,EAAqBC,CAAI,EAAGU,CAAQ,EAC/D,EAEMJ,EAAwBN,GAAiB,CAC9CF,EAAc,UAAUC,EAAqBC,CAAI,EAAG,MAAS,CAC9D,EAEA,OACCC,KAAA,gBACAE,KAAA,WACAC,KAAA,yBACAG,KAAA,oBACAC,KAAA,wBACAhB,KAAA",
  "names": ["EventProvider", "ComponentFeature", "args", "features", "componentFeatures", "subscribers", "EVENT_NAME", "eventProvider", "featureLoadEventName", "name", "registerFeature", "feature", "getFeature", "registerComponentFeature", "dep", "notifyForFeatureLoad", "getComponentFeature", "subscribeForFeatureLoad", "klass", "callback", "subscriber"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy