@blac/core
Advanced tools
+5
-8
@@ -123,3 +123,3 @@ | ||
| * Release a reference to an instance | ||
| * Disposes when ref count reaches zero (unless keepAlive) | ||
| * Disposes when ref count reaches zero (unless static keepAlive is true) | ||
| */ | ||
@@ -136,3 +136,4 @@ release(constructor, key, forceDispose = false) { | ||
| entry.refCount--; | ||
| if (entry.refCount <= 0 && !entry.instance.keepAlive) { | ||
| const keepAlive = constructor.keepAlive === true; | ||
| if (entry.refCount <= 0 && !keepAlive) { | ||
| entry.instance.dispose(); | ||
@@ -284,3 +285,2 @@ this.instances.delete(instanceKey); | ||
| name; | ||
| keepAlive; | ||
| debug; | ||
@@ -295,3 +295,2 @@ instanceId; | ||
| this.name = config.name || this.constructor.name; | ||
| this.keepAlive = config.keepAlive ?? false; | ||
| this.debug = config.debug ?? false; | ||
@@ -428,2 +427,3 @@ this.instanceId = config.instanceId || generateSimpleId(this.constructor.name); | ||
| var TodoCubit = class extends Cubit { | ||
| static keepAlive = true; | ||
| nextId = 0; | ||
@@ -435,6 +435,3 @@ constructor() { | ||
| isLoading: false | ||
| }, { | ||
| name: "TodoCubit", | ||
| keepAlive: true | ||
| }); | ||
| }, { name: "TodoCubit" }); | ||
| } | ||
@@ -441,0 +438,0 @@ addTodo = (text) => { |
+2
-6
@@ -21,3 +21,3 @@ //#region src/core/StateContainerRegistry.d.ts | ||
| * Release a reference to an instance | ||
| * Disposes when ref count reaches zero (unless keepAlive) | ||
| * Disposes when ref count reaches zero (unless static keepAlive is true) | ||
| */ | ||
@@ -66,4 +66,2 @@ release<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string, forceDispose?: boolean): void; | ||
| name?: string; | ||
| /** Whether to keep container alive when no consumers */ | ||
| keepAlive?: boolean; | ||
| /** Enable debug logging */ | ||
@@ -73,4 +71,2 @@ debug?: boolean; | ||
| instanceId?: string; | ||
| /** Whether this instance should be isolated (not shared) */ | ||
| isolated?: boolean; | ||
| } | ||
@@ -141,3 +137,2 @@ /** | ||
| readonly name: string; | ||
| readonly keepAlive: boolean; | ||
| readonly debug: boolean; | ||
@@ -245,2 +240,3 @@ readonly instanceId: string; | ||
| declare class TodoCubit extends Cubit<TodoState> { | ||
| static keepAlive: boolean; | ||
| private nextId; | ||
@@ -247,0 +243,0 @@ constructor(); |
+2
-6
@@ -21,3 +21,3 @@ //#region src/core/StateContainerRegistry.d.ts | ||
| * Release a reference to an instance | ||
| * Disposes when ref count reaches zero (unless keepAlive) | ||
| * Disposes when ref count reaches zero (unless static keepAlive is true) | ||
| */ | ||
@@ -66,4 +66,2 @@ release<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string, forceDispose?: boolean): void; | ||
| name?: string; | ||
| /** Whether to keep container alive when no consumers */ | ||
| keepAlive?: boolean; | ||
| /** Enable debug logging */ | ||
@@ -73,4 +71,2 @@ debug?: boolean; | ||
| instanceId?: string; | ||
| /** Whether this instance should be isolated (not shared) */ | ||
| isolated?: boolean; | ||
| } | ||
@@ -141,3 +137,2 @@ /** | ||
| readonly name: string; | ||
| readonly keepAlive: boolean; | ||
| readonly debug: boolean; | ||
@@ -245,2 +240,3 @@ readonly instanceId: string; | ||
| declare class TodoCubit extends Cubit<TodoState> { | ||
| static keepAlive: boolean; | ||
| private nextId; | ||
@@ -247,0 +243,0 @@ constructor(); |
+5
-8
@@ -122,3 +122,3 @@ //#region src/utils/idGenerator.ts | ||
| * Release a reference to an instance | ||
| * Disposes when ref count reaches zero (unless keepAlive) | ||
| * Disposes when ref count reaches zero (unless static keepAlive is true) | ||
| */ | ||
@@ -135,3 +135,4 @@ release(constructor, key, forceDispose = false) { | ||
| entry.refCount--; | ||
| if (entry.refCount <= 0 && !entry.instance.keepAlive) { | ||
| const keepAlive = constructor.keepAlive === true; | ||
| if (entry.refCount <= 0 && !keepAlive) { | ||
| entry.instance.dispose(); | ||
@@ -283,3 +284,2 @@ this.instances.delete(instanceKey); | ||
| name; | ||
| keepAlive; | ||
| debug; | ||
@@ -294,3 +294,2 @@ instanceId; | ||
| this.name = config.name || this.constructor.name; | ||
| this.keepAlive = config.keepAlive ?? false; | ||
| this.debug = config.debug ?? false; | ||
@@ -427,2 +426,3 @@ this.instanceId = config.instanceId || generateSimpleId(this.constructor.name); | ||
| var TodoCubit = class extends Cubit { | ||
| static keepAlive = true; | ||
| nextId = 0; | ||
@@ -434,6 +434,3 @@ constructor() { | ||
| isLoading: false | ||
| }, { | ||
| name: "TodoCubit", | ||
| keepAlive: true | ||
| }); | ||
| }, { name: "TodoCubit" }); | ||
| } | ||
@@ -440,0 +437,0 @@ addTodo = (text) => { |
+1
-1
| { | ||
| "name": "@blac/core", | ||
| "version": "2.0.0-rc.3", | ||
| "version": "2.0.0-rc.4", | ||
| "license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Brendan Mullins <jsnanigans@gmail.com>", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
273360
-0.23%3513
-0.28%