Hey ๐ For now you ll need to define
Hey!
For now, you'll need to define your own
A better solution is in the works though.
ExecutionContext class:A better solution is in the works though.
class ExecutionContext {
promises = [];
waitUntil(promise) { this.promises.push(promise); }
passThroughOnException() {}
}
...
const env = getMiniflareBindings();
const ctx = new ExecutionContext();
const response = await worker.fetch(request, env, ctx);
await Promise.all(ctx.promises);ExecutionContext should be provided as a global class as of Miniflare 2.8.0 (https://github.com/cloudflare/miniflare/releases/tag/v2.8.0).
@cloudflare/workers-types type.// @ts-expect-error comment. 2.8.0@cloudflare/workers-typesdeclare global {
class ExecutionContext {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
}
}