core: upgrade to context tracing

This commit is contained in:
undefined committed 2024-10-05 20:38:20 +08:00
1 parent e79e978b15
commit 28b3abf441
9 files changed
+42 -38

No files matched your search

+5 -3
View File
@@ -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}`];
};
});
}
+5 -3
View File
@@ -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];
};
});
}