Add disposable util
This commit is contained in:
parent
5b41794947
commit
1c7600c3b8
1 changed files with 8 additions and 0 deletions
8
src/app/utils/disposable.ts
Normal file
8
src/app/utils/disposable.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export type DisposeCallback<Q extends unknown[] = [], R = void> = (...args: Q) => R;
|
||||||
|
export type DisposableContext<P extends unknown[] = [], Q extends unknown[] = [], R = void> = (
|
||||||
|
...args: P
|
||||||
|
) => DisposeCallback<Q, R>;
|
||||||
|
|
||||||
|
export const disposable = <P extends unknown[], Q extends unknown[] = [], R = void>(
|
||||||
|
context: DisposableContext<P, Q, R>
|
||||||
|
) => context;
|
Loading…
Reference in a new issue