refactor: register

This commit is contained in:
xiaojunnuo
2023-05-09 10:16:49 +08:00
parent e123ec4089
commit 9747d40734
24 changed files with 144 additions and 19 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ export class Executor {
});
Decorator.inject(define.autowire, instance, context);
await instance.onInit();
await instance.onInstance();
await instance.execute();
//输出到output context
+1 -1
View File
@@ -34,7 +34,7 @@ export type PluginDefine = Registrable & {
};
export interface ITaskPlugin {
onInit(): Promise<void>;
onInstance(): Promise<void>;
execute(): Promise<void>;
}
@@ -20,6 +20,10 @@ export class EchoPlugin implements ITaskPlugin {
// @ts-ignore
logger: ILogger;
onInstance(): Promise<void> {
throw new Error("Method not implemented.");
}
async execute(): Promise<void> {
return Promise.resolve(undefined);
}
+1 -1
View File
@@ -23,7 +23,7 @@ export class EchoPlugin implements ITaskPlugin {
certInfo!: any;
// eslint-disable-next-line @typescript-eslint/no-empty-function
async onInit(): Promise<void> {}
async onInstance(): Promise<void> {}
async execute(): Promise<void> {
console.log("input :cert", this.cert);
}