@livelybone/singleton 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/lib/es/index.js +2 -1
- package/lib/umd/index.js +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
@@ -38,7 +38,7 @@ declare function singletonObj<T extends any>(id: ID, defaultValue?: () => T): T
|
|
38
38
|
* Return a singleton of an object(such as Promise, Function, Object...) corresponding to the id.
|
39
39
|
* This method will cause OOM if it's used too much without calling `delete`.
|
40
40
|
* */
|
41
|
-
declare function singleton<T extends
|
41
|
+
declare function singleton<T extends any>(
|
42
42
|
id: ID,
|
43
43
|
defaultValue?: () => T,
|
44
44
|
): {
|
package/lib/es/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Bundle of @livelybone/singleton
|
3
3
|
* Generated: 2023-08-10
|
4
|
-
* Version: 1.3.
|
4
|
+
* Version: 1.3.6
|
5
5
|
* License: MIT
|
6
6
|
* Author: 2631541504@qq.com
|
7
7
|
*/
|
@@ -53,6 +53,7 @@ function singleton(id, defaultValue) {
|
|
53
53
|
return ids.delete(k);
|
54
54
|
},
|
55
55
|
update: function update(action) {
|
56
|
+
// @ts-ignore
|
56
57
|
var v = typeof action === 'function' ? action(ids.get()) : action;
|
57
58
|
ids.set(k, v);
|
58
59
|
return v;
|
package/lib/umd/index.js
CHANGED