Skip to content

Commit

Permalink
chore: show log once
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 8, 2024
1 parent 0b2da15 commit 9975161
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/nitro/plugins/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook("request", (event) => {
nitroApp.hooks.hookOnce("request", (event) => {
console.log(
"event.context.cloudflare in request hook",
!!event.context.cloudflare,
Expand Down
2 changes: 2 additions & 0 deletions examples/nitro/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ export default eventHandler((event) => {
`typeof cloudflare.context.waitUntil: ${typeof cloudflare.context.waitUntil}`,
);

event.waitUntil(Promise.resolve());

return `<div><ul><br>${logs.map((str) => `<li>${str}</li>`).join("\n<br>\n")}</ul></div>`;
});

0 comments on commit 9975161

Please sign in to comment.