Skip to content

Commit

Permalink
feat: add a Webda.UpdateContextRoute to be able to alter router decision
Browse files Browse the repository at this point in the history
  • Loading branch information
loopingz committed Jul 7, 2023
1 parent b71f1ca commit 22463f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/src/core.ts
Expand Up @@ -224,6 +224,12 @@ export type CoreEvents = {
context: OperationContext;
info: ContextProviderInfo;
};
/**
* Sent when route is added to context
*/
"Webda.UpdateContextRoute": {
context: WebContext;
};
[key: string]: unknown;
};

Expand Down Expand Up @@ -963,6 +969,7 @@ export class Core<E extends CoreEvents = CoreEvents> extends events.EventEmitter
}
ctx.setRoute({ ...this.configuration, ...route });
ctx.setExecutor(this.getService(route.executor));
this.emit("Webda.UpdateContextRoute", {context: ctx});
return true;
}

Expand Down

0 comments on commit 22463f9

Please sign in to comment.