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

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

{
  "version": 3,
  "sources": ["../../src/RenderQueue.ts"],
  "sourcesContent": ["import type UI5Element from \"./UI5Element.js\";\n\nconst MAX_PROCESS_COUNT = 10;\n\nclass RenderQueue {\n\tlist: Array;\n\tlookup: Set;\n\n\tconstructor() {\n\t\tthis.list = []; // Used to store the web components in order\n\t\tthis.lookup = new Set(); // Used for faster search\n\t}\n\n\tadd(webComponent: UI5Element) {\n\t\tif (this.lookup.has(webComponent)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.list.push(webComponent);\n\t\tthis.lookup.add(webComponent);\n\t}\n\n\tremove(webComponent: UI5Element) {\n\t\tif (!this.lookup.has(webComponent)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.list = this.list.filter(item => item !== webComponent);\n\t\tthis.lookup.delete(webComponent);\n\t}\n\n\tshift() {\n\t\tconst webComponent = this.list.shift();\n\t\tif (webComponent) {\n\t\t\tthis.lookup.delete(webComponent);\n\t\t\treturn webComponent;\n\t\t}\n\t}\n\n\tisEmpty() {\n\t\treturn this.list.length === 0;\n\t}\n\n\tisAdded(webComponent: UI5Element) {\n\t\treturn this.lookup.has(webComponent);\n\t}\n\n\t/**\n\t * Processes the whole queue by executing the callback on each component,\n\t * while also imposing restrictions on how many times a component may be processed.\n\t *\n\t * @param callback - function with one argument (the web component to be processed)\n\t */\n\tprocess(callback: (el: UI5Element) => void) {\n\t\tlet webComponent;\n\t\tconst stats = new Map();\n\n\t\twebComponent = this.shift();\n\t\twhile (webComponent) {\n\t\t\tconst timesProcessed = stats.get(webComponent) || 0;\n\t\t\tif (timesProcessed > MAX_PROCESS_COUNT) {\n\t\t\t\tthrow new Error(`Web component processed too many times this task, max allowed is: ${MAX_PROCESS_COUNT}`);\n\t\t\t}\n\t\t\tcallback(webComponent);\n\t\t\tstats.set(webComponent, timesProcessed + 1);\n\t\t\twebComponent = this.shift();\n\t\t}\n\t}\n}\n\nexport default RenderQueue;\n"],
  "mappings": "aAEA,MAAMA,EAAoB,GAE1B,MAAMC,CAAY,CAIjB,aAAc,CACb,KAAK,KAAO,CAAC,EACb,KAAK,OAAS,IAAI,GACnB,CAEA,IAAIC,EAA0B,CACzB,KAAK,OAAO,IAAIA,CAAY,IAIhC,KAAK,KAAK,KAAKA,CAAY,EAC3B,KAAK,OAAO,IAAIA,CAAY,EAC7B,CAEA,OAAOA,EAA0B,CAC3B,KAAK,OAAO,IAAIA,CAAY,IAIjC,KAAK,KAAO,KAAK,KAAK,OAAOC,GAAQA,IAASD,CAAY,EAC1D,KAAK,OAAO,OAAOA,CAAY,EAChC,CAEA,OAAQ,CACP,MAAMA,EAAe,KAAK,KAAK,MAAM,EACrC,GAAIA,EACH,YAAK,OAAO,OAAOA,CAAY,EACxBA,CAET,CAEA,SAAU,CACT,OAAO,KAAK,KAAK,SAAW,CAC7B,CAEA,QAAQA,EAA0B,CACjC,OAAO,KAAK,OAAO,IAAIA,CAAY,CACpC,CAQA,QAAQE,EAAoC,CAC3C,IAAIF,EACJ,MAAMG,EAAQ,IAAI,IAGlB,IADAH,EAAe,KAAK,MAAM,EACnBA,GAAc,CACpB,MAAMI,EAAiBD,EAAM,IAAIH,CAAY,GAAK,EAClD,GAAII,EAAiB,GACpB,MAAM,IAAI,MAAM,sEAAwF,EAEzGF,EAASF,CAAY,EACrBG,EAAM,IAAIH,EAAcI,EAAiB,CAAC,EAC1CJ,EAAe,KAAK,MAAM,CAC3B,CACD,CACD,CAEA,eAAeD",
  "names": ["MAX_PROCESS_COUNT", "RenderQueue", "webComponent", "item", "callback", "stats", "timesProcessed"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy