mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
core: upgrade to context tracing
This commit is contained in:
9 files changed
+42
-38
No files matched your search
@@ -13,9 +13,11 @@ export class CheckService extends Service {
|
||||
checkers: Dictionary<CheckItem> = {};
|
||||
c = {};
|
||||
addChecker(type: string, checkFunc: CheckItem) {
|
||||
this.checkers[`check${type}`] = checkFunc;
|
||||
this[Context.current]?.on('dispose', () => {
|
||||
delete this.checkers[`check${type}`];
|
||||
this.ctx.effect(() => {
|
||||
this.checkers[`check${type}`] = checkFunc;
|
||||
return () => {
|
||||
delete this.checkers[`check${type}`];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,11 @@ export class WorkerService extends Service {
|
||||
}
|
||||
|
||||
public addHandler(type: string, handler: Function) {
|
||||
this.handlers[type] = handler;
|
||||
this[Context.current]?.on('dispose', () => {
|
||||
delete this.handlers[type];
|
||||
this.ctx.effect(() => {
|
||||
this.handlers[type] = handler;
|
||||
return () => {
|
||||
delete this.handlers[type];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user