Skip to content

Commit

Permalink
feat: 显式注册函数插桩支持
Browse files Browse the repository at this point in the history
  • Loading branch information
MarleneJiang committed Sep 2, 2023
1 parent 664163f commit a22db59
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions package/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export class PipeRegistry {
return result;
},
};

static customFn: Record<
string,
(result: any, context: PipelineContext) => any
> = {};

static init() {
const pipeRegistry = new PipeRegistry();
//遍历commonPreProcess进行pipeRegistry.register注册
Expand All @@ -45,6 +51,10 @@ export class PipeRegistry {
Object.entries(PipeRegistry.commonPostProcess).forEach(([type, fn]) => {
pipeRegistry.register(type, fn);
});
//遍历customFn进行pipeRegistry.register注册
Object.entries(PipeRegistry.customFn).forEach(([type, fn]) => {
pipeRegistry.register(type, fn);
});
return pipeRegistry;
}
}

0 comments on commit a22db59

Please sign in to comment.