@gby/destroyable 1.0.1 → 1.0.2
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/dist/Destroyable.d.ts +24 -3
- package/dist/DestroyableSub.d.ts +14 -0
- package/dist/DestroyableSub.d.ts.map +1 -1
- package/dist/createDestroyableSubClass.d.ts +10 -3
- package/dist/createDestroyableSubClass.d.ts.map +1 -1
- package/doc/api/destroyable.createdestroyablesubclass.md +9 -2
- package/doc/api/destroyable.destroyablesub.md +1 -1
- package/doc/api/destroyable.destroyablesubclass.md +1 -1
- package/doc/api/destroyable.nodedestroyable.md +7 -0
- package/doc/api/destroyable.webdestroyable.md +7 -0
- package/package.json +1 -1
package/dist/Destroyable.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { FunDestroyer as FunDestroyer_2 } from './Destroyable';
|
|
|
18
18
|
* @param ParentClass
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
|
-
export declare function createDestroyableSubClass<P extends new (...args: any) =>
|
|
21
|
+
export declare function createDestroyableSubClass<P extends new (...args: any) => Object>(ParentClass: P): {
|
|
22
22
|
new (...args: any): {
|
|
23
23
|
/**
|
|
24
24
|
* 是否已经销毁
|
|
@@ -80,6 +80,13 @@ export declare function createDestroyableSubClass<P extends new (...args: any) =
|
|
|
80
80
|
* 会依次执行销毁,并且只有上一个销毁完成之后才会执行下一个销毁
|
|
81
81
|
*/
|
|
82
82
|
destroyAsync(): Promise<true | undefined>;
|
|
83
|
+
constructor: Function;
|
|
84
|
+
toString(): string;
|
|
85
|
+
toLocaleString(): string;
|
|
86
|
+
valueOf(): Object;
|
|
87
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
88
|
+
isPrototypeOf(v: Object): boolean;
|
|
89
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
83
90
|
};
|
|
84
91
|
} & P;
|
|
85
92
|
|
|
@@ -152,12 +159,12 @@ export declare class Destroyable {
|
|
|
152
159
|
/**
|
|
153
160
|
* createDestroyableSubClass 创建的类的实例类型
|
|
154
161
|
*/
|
|
155
|
-
export declare type DestroyableSub<ParentClass extends new (...args: any) =>
|
|
162
|
+
export declare type DestroyableSub<ParentClass extends new (...args: any) => Object> = InstanceType<DestroyableSubClass<ParentClass>>;
|
|
156
163
|
|
|
157
164
|
/**
|
|
158
165
|
* createDestroyableSubClass 创建的类的类型
|
|
159
166
|
*/
|
|
160
|
-
export declare type DestroyableSubClass<ParentClass extends new (...args: any) =>
|
|
167
|
+
export declare type DestroyableSubClass<ParentClass extends new (...args: any) => Object> = ReturnType<typeof createDestroyableSubClass<ParentClass>>;
|
|
161
168
|
|
|
162
169
|
/**
|
|
163
170
|
* 销毁 Destroyable 对象
|
|
@@ -199,6 +206,13 @@ export declare const NodeDestroyable: {
|
|
|
199
206
|
destroyThis(): void;
|
|
200
207
|
destroy(): true | undefined;
|
|
201
208
|
destroyAsync(): Promise<true | undefined>;
|
|
209
|
+
constructor: Function;
|
|
210
|
+
toString(): string;
|
|
211
|
+
toLocaleString(): string;
|
|
212
|
+
valueOf(): Object;
|
|
213
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
214
|
+
isPrototypeOf(v: Object): boolean;
|
|
215
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
202
216
|
};
|
|
203
217
|
} & typeof EventEmitter;
|
|
204
218
|
|
|
@@ -238,6 +252,13 @@ export declare const WebDestroyable: {
|
|
|
238
252
|
destroyThis(): void;
|
|
239
253
|
destroy(): true | undefined;
|
|
240
254
|
destroyAsync(): Promise<true | undefined>;
|
|
255
|
+
constructor: Function;
|
|
256
|
+
toString(): string;
|
|
257
|
+
toLocaleString(): string;
|
|
258
|
+
valueOf(): Object;
|
|
259
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
260
|
+
isPrototypeOf(v: Object): boolean;
|
|
261
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
241
262
|
};
|
|
242
263
|
} & typeof EventBus;
|
|
243
264
|
|
package/dist/DestroyableSub.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export declare const WebDestroyable: {
|
|
|
21
21
|
destroyThis(): void;
|
|
22
22
|
destroy(): true | undefined;
|
|
23
23
|
destroyAsync(): Promise<true | undefined>;
|
|
24
|
+
constructor: Function;
|
|
25
|
+
toString(): string;
|
|
26
|
+
toLocaleString(): string;
|
|
27
|
+
valueOf(): Object;
|
|
28
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
29
|
+
isPrototypeOf(v: Object): boolean;
|
|
30
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
24
31
|
};
|
|
25
32
|
} & typeof EventBus;
|
|
26
33
|
/**
|
|
@@ -52,6 +59,13 @@ export declare const NodeDestroyable: {
|
|
|
52
59
|
destroyThis(): void;
|
|
53
60
|
destroy(): true | undefined;
|
|
54
61
|
destroyAsync(): Promise<true | undefined>;
|
|
62
|
+
constructor: Function;
|
|
63
|
+
toString(): string;
|
|
64
|
+
toLocaleString(): string;
|
|
65
|
+
valueOf(): Object;
|
|
66
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
67
|
+
isPrototypeOf(v: Object): boolean;
|
|
68
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
55
69
|
};
|
|
56
70
|
} & typeof EventEmitter;
|
|
57
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DestroyableSub.d.ts","sourceRoot":"","sources":["../src/DestroyableSub.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"DestroyableSub.d.ts","sourceRoot":"","sources":["../src/DestroyableSub.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAsC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,cAAc,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;uBAA0C,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,eAAe,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import type { FunDestroyer } from "./Destroyable";
|
|
|
6
6
|
* @param ParentClass
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function createDestroyableSubClass<P extends new (...args: any) =>
|
|
9
|
+
export declare function createDestroyableSubClass<P extends new (...args: any) => Object>(ParentClass: P): {
|
|
10
10
|
new (...args: any): {
|
|
11
11
|
/**
|
|
12
12
|
* 是否已经销毁
|
|
@@ -68,14 +68,21 @@ export declare function createDestroyableSubClass<P extends new (...args: any) =
|
|
|
68
68
|
* 会依次执行销毁,并且只有上一个销毁完成之后才会执行下一个销毁
|
|
69
69
|
*/
|
|
70
70
|
destroyAsync(): Promise<true | undefined>;
|
|
71
|
+
constructor: Function;
|
|
72
|
+
toString(): string;
|
|
73
|
+
toLocaleString(): string;
|
|
74
|
+
valueOf(): Object;
|
|
75
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
76
|
+
isPrototypeOf(v: Object): boolean;
|
|
77
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
71
78
|
};
|
|
72
79
|
} & P;
|
|
73
80
|
/**
|
|
74
81
|
* createDestroyableSubClass 创建的类的类型
|
|
75
82
|
*/
|
|
76
|
-
export type DestroyableSubClass<ParentClass extends new (...args: any) =>
|
|
83
|
+
export type DestroyableSubClass<ParentClass extends new (...args: any) => Object> = ReturnType<typeof createDestroyableSubClass<ParentClass>>;
|
|
77
84
|
/**
|
|
78
85
|
* createDestroyableSubClass 创建的类的实例类型
|
|
79
86
|
*/
|
|
80
|
-
export type DestroyableSub<ParentClass extends new (...args: any) =>
|
|
87
|
+
export type DestroyableSub<ParentClass extends new (...args: any) => Object> = InstanceType<DestroyableSubClass<ParentClass>>;
|
|
81
88
|
//# sourceMappingURL=createDestroyableSubClass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDestroyableSubClass.d.ts","sourceRoot":"","sources":["../src/createDestroyableSubClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"createDestroyableSubClass.d.ts","sourceRoot":"","sources":["../src/createDestroyableSubClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,EAAE,WAAW,EAAE,CAAC;kBAA9B,GAAG;QAO7D;;WAEG;;;QAMH;;WAEG;qBACU,YAAY,EAAE;QAE3B;;;;WAIG;mBACQ,CAAC,SAAS,YAAY,OAAO,CAAC,GAAG,CAAC;QAK7C;;;;WAIG;yBACc,CAAC,SAAS,YAAY,OAAO,CAAC,GAAG,CAAC;QAMnD;;;;;WAKG;mBACQ,CAAC,8BAA8B,CAAC,SAAS,OAAO,GAAG,CAAC;QAQ/D;;;;WAIG;yBACc,CAAC,8BAA8B,CAAC,GAAG,CAAC;QASrD;;;WAGG;gBACK,CAAC,SAAS,YAAY,OAAO,CAAC,GAAG,CAAC;gBAClC,CAAC,8BAA8B,CAAC,iBAAiB,OAAO,GAAG,CAAC;gBAC5D,CAAC,SAAS,iBAAiB,YAAY,YAAY,CAAC,iBAAiB,OAAO,GAAG,CAAC;sBAS1E,CAAC,SAAS,YAAY,OAAO,CAAC,GAAG,CAAC;sBAClC,CAAC,8BAA8B,CAAC,GAAG,CAAC;sBACpC,CAAC,SAAS,iBAAiB,YAAY,YAAY,CAAC,GAAG,CAAC;QActE;;;;WAIG;;QAMH;;WAEG;;QAkBH;;;;WAIG;;;;;;;;;;MAiDV;AAMD;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,WAAW,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,IAAI,UAAU,CAAC,OAAO,yBAAyB,CAAC,WAAW,CAAC,CAAC,CAAC;AAE9I;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,WAAW,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,IAAI,YAAY,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export declare function createDestroyableSubClass<P extends new (...args: any) =>
|
|
12
|
+
export declare function createDestroyableSubClass<P extends new (...args: any) => Object>(ParentClass: P): {
|
|
13
13
|
new (...args: any): {
|
|
14
14
|
readonly isDestroyed: boolean;
|
|
15
15
|
_isDestroyed: boolean;
|
|
@@ -27,6 +27,13 @@ export declare function createDestroyableSubClass<P extends new (...args: any) =
|
|
|
27
27
|
destroyThis(): void;
|
|
28
28
|
destroy(): true | undefined;
|
|
29
29
|
destroyAsync(): Promise<true | undefined>;
|
|
30
|
+
constructor: Function;
|
|
31
|
+
toString(): string;
|
|
32
|
+
toLocaleString(): string;
|
|
33
|
+
valueOf(): Object;
|
|
34
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
35
|
+
isPrototypeOf(v: Object): boolean;
|
|
36
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
30
37
|
};
|
|
31
38
|
} & P;
|
|
32
39
|
```
|
|
@@ -66,7 +73,7 @@ P
|
|
|
66
73
|
</tbody></table>
|
|
67
74
|
**Returns:**
|
|
68
75
|
|
|
69
|
-
{ new (...args: any): { readonly isDestroyed: boolean; \_isDestroyed: boolean; \_destroyers: [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->\[\]; disposeFun<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; cancelDisposeFun<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; disposeObj<T extends /\*elided\*/ any>(obj: T, sync?: boolean): T; cancelDisposeObj<T extends /\*elided\*/ any>(obj: T): T; dispose<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; dispose<T extends /\*elided\*/ any>(obj: T, asyncDestroy?: boolean): T; dispose<T extends /\*elided\*/ any \| [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(objOrFun: T, asyncDestroy?: boolean): T; cancelDispose<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; cancelDispose<T extends /\*elided\*/ any>(obj: T): T; cancelDispose<T extends /\*elided\*/ any \| [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(objOrFun: T): T; destroyThis(): void; destroy(): true \| undefined; destroyAsync(): Promise<true \| undefined>; }; } & P
|
|
76
|
+
{ new (...args: any): { readonly isDestroyed: boolean; \_isDestroyed: boolean; \_destroyers: [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->\[\]; disposeFun<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; cancelDisposeFun<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; disposeObj<T extends /\*elided\*/ any>(obj: T, sync?: boolean): T; cancelDisposeObj<T extends /\*elided\*/ any>(obj: T): T; dispose<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; dispose<T extends /\*elided\*/ any>(obj: T, asyncDestroy?: boolean): T; dispose<T extends /\*elided\*/ any \| [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(objOrFun: T, asyncDestroy?: boolean): T; cancelDispose<T extends [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(fun: T): T; cancelDispose<T extends /\*elided\*/ any>(obj: T): T; cancelDispose<T extends /\*elided\*/ any \| [FunDestroyer](./destroyable.fundestroyer.md)<!-- -->>(objOrFun: T): T; destroyThis(): void; destroy(): true \| undefined; destroyAsync(): Promise<true \| undefined>; constructor: Function; toString(): string; toLocaleString(): string; valueOf(): Object; hasOwnProperty(v: PropertyKey): boolean; isPrototypeOf(v: Object): boolean; propertyIsEnumerable(v: PropertyKey): boolean; }; } & P
|
|
70
77
|
|
|
71
78
|
|
|
72
79
|
## Remarks
|
|
@@ -9,7 +9,7 @@ createDestroyableSubClass 创建的类的实例类型
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export type DestroyableSub<ParentClass extends new (...args: any) =>
|
|
12
|
+
export type DestroyableSub<ParentClass extends new (...args: any) => Object> = InstanceType<DestroyableSubClass<ParentClass>>;
|
|
13
13
|
```
|
|
14
14
|
**References:** [DestroyableSubClass](./destroyable.destroyablesubclass.md)
|
|
15
15
|
|
|
@@ -9,5 +9,5 @@ createDestroyableSubClass 创建的类的类型
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export type DestroyableSubClass<ParentClass extends new (...args: any) =>
|
|
12
|
+
export type DestroyableSubClass<ParentClass extends new (...args: any) => Object> = ReturnType<typeof createDestroyableSubClass<ParentClass>>;
|
|
13
13
|
```
|
|
@@ -27,6 +27,13 @@ NodeDestroyable: {
|
|
|
27
27
|
destroyThis(): void;
|
|
28
28
|
destroy(): true | undefined;
|
|
29
29
|
destroyAsync(): Promise<true | undefined>;
|
|
30
|
+
constructor: Function;
|
|
31
|
+
toString(): string;
|
|
32
|
+
toLocaleString(): string;
|
|
33
|
+
valueOf(): Object;
|
|
34
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
35
|
+
isPrototypeOf(v: Object): boolean;
|
|
36
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
30
37
|
};
|
|
31
38
|
} & typeof EventEmitter
|
|
32
39
|
```
|
|
@@ -27,6 +27,13 @@ WebDestroyable: {
|
|
|
27
27
|
destroyThis(): void;
|
|
28
28
|
destroy(): true | undefined;
|
|
29
29
|
destroyAsync(): Promise<true | undefined>;
|
|
30
|
+
constructor: Function;
|
|
31
|
+
toString(): string;
|
|
32
|
+
toLocaleString(): string;
|
|
33
|
+
valueOf(): Object;
|
|
34
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
35
|
+
isPrototypeOf(v: Object): boolean;
|
|
36
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
30
37
|
};
|
|
31
38
|
} & typeof EventBus
|
|
32
39
|
```
|