Skip to content

Commit

Permalink
allow extension.serve to be passed to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Sep 9, 2023
1 parent 70e4c8a commit 571e80b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion types/typescript/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export class Extension {
return runner(params);
}

async fetch(req: Request) {
// here we need an arrow function to preserve the `this` context when using Deno.serve(extension.fetch)
fetch = async (req: Request) => {
if (req.method === "GET") {
return Response.json(this.manifest);
}
Expand Down

0 comments on commit 571e80b

Please sign in to comment.