mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 14:25:17 +00:00
Added experimental autoFreezable method in bundle (probably I'll regret it)
This commit is contained in:
@@ -32,12 +32,35 @@ export default class Bundle {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @EXPERIMENTAL
|
||||
*
|
||||
* @param mimeType
|
||||
*/
|
||||
|
||||
static autoFreezable(mimeType: `${Mime.type}/${Mime.subtype}`): Bundle {
|
||||
const bundle = new Bundle(mimeType);
|
||||
|
||||
/**
|
||||
* @TODO
|
||||
* Might not be the best idea I might have had.
|
||||
* I have to test this further more to check if
|
||||
* actually we can leverage of this event loop feature
|
||||
* to freeze it automatically once we processed every
|
||||
* promise for bundling;
|
||||
*/
|
||||
|
||||
setTimeout(bundle.freeze, 0);
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Freezes / Closes the bundle so no more files
|
||||
* can be added any further.
|
||||
*/
|
||||
|
||||
private freeze() {
|
||||
protected freeze() {
|
||||
if (this[bundleStateSymbol] === BundleState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user