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

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

{"version":3,"file":"FeaturesRegistry.js","sourceRoot":"","sources":["../src/FeaturesRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAG/C,MAAe,gBAAgB;IAC9B,gFAAgF;IAChF,YAAY,GAAG,IAAW,IAAG,CAAC;CAG9B;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;AACxC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;AAC9D,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoC,CAAC;AAEhE,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,aAAa,GAAG,IAAI,aAAa,EAAmB,CAAC;AAE3D,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC;AAEvE,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,EAAE;IACzD,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAI,IAAY,EAAK,EAAE;IACzC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAM,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,KAAK,EAAE,IAAY,EAAE,OAAgC,EAAE,EAAE;IACzF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACxE,MAAM,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAEzB,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAI,IAAY,EAAK,EAAE;IAClD,OAAO,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAM,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,KAAwB,EAAE,QAAoB,EAAE,EAAE;IAChG,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEhD,IAAI,YAAY,EAAE;QACjB,OAAO;KACP;IAED,IAAI,CAAC,UAAU,EAAE;QAChB,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;KAC/B;SAAM;QACN,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACtB;IAED,aAAa,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC7C,aAAa,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,OAAO,EACN,eAAe,EACf,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GAChB,CAAC","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"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy