@podium/utils
Advanced tools
Comparing version 5.3.0 to 5.3.1
@@ -0,1 +1,8 @@ | ||
## [5.3.1](https://github.com/podium-lib/utils/compare/v5.3.0...v5.3.1) (2024-09-22) | ||
### Bug Fixes | ||
* receive and emit hinted assets ([a07e0e3](https://github.com/podium-lib/utils/commit/a07e0e3b69d0a372d20417d9410bd50698c9af19)) | ||
# [5.3.0](https://github.com/podium-lib/utils/compare/v5.2.1...v5.3.0) (2024-09-20) | ||
@@ -2,0 +9,0 @@ |
@@ -5,3 +5,3 @@ import { EventEmitter } from 'node:events'; | ||
#expectedHints = new Set(); | ||
#receivedHints = new Set(); | ||
#receivedHints = new Map(); | ||
@@ -27,7 +27,11 @@ // pointless constructor with super to appease TS which cryptically errors otherwise. | ||
* @param {string} name - The name of the hint | ||
* @param {{js: Array<import('./asset-js.js').JavaScriptAsset | string>, css: Array<import('./asset-css.js').CssAsset | string>}} assets - The hinted assets for a given resource | ||
*/ | ||
addReceivedHint(name) { | ||
this.#receivedHints.add(name); | ||
addReceivedHint(name, assets = { js: [], css: [] }) { | ||
this.#receivedHints.set(name, assets); | ||
if (this.allHintsReceived) { | ||
this.emit('complete'); | ||
const assets = Array.from(this.#receivedHints.values()); | ||
const js = assets.flatMap(({ js = [] }) => js).filter(Boolean); | ||
const css = assets.flatMap(({ css = [] }) => css).filter(Boolean); | ||
this.emit('complete', { js, css }); | ||
} | ||
@@ -34,0 +38,0 @@ } |
{ | ||
"name": "@podium/utils", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "Common generic utility methods shared by @podium modules.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -14,4 +14,8 @@ export class Hints extends EventEmitter<[never]> { | ||
* @param {string} name - The name of the hint | ||
* @param {{js: Array<import('./asset-js.js').JavaScriptAsset | string>, css: Array<import('./asset-css.js').CssAsset | string>}} assets - The hinted assets for a given resource | ||
*/ | ||
addReceivedHint(name: string): void; | ||
addReceivedHint(name: string, assets?: { | ||
js: Array<import("./asset-js.js").JavaScriptAsset | string>; | ||
css: Array<import("./asset-css.js").CssAsset | string>; | ||
}): void; | ||
/** | ||
@@ -18,0 +22,0 @@ * Value will be true if all expected hints have been received |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93733
1586