attachFetchHandler function
Implementation
void attachFetchHandler(CloudflareWorkersFetchEvent handler) {
globalDartFetchHandler = allowInterop((interop.Request req,
interop.Environment env, interop.ExecutionContext ctx) {
return futureToPromise(Future(() async {
final response = await handler(
requestFromJsObject(req),
environmentFromJsObject(env),
executionContextFromJsObject(ctx),
);
return response.delegate;
}));
});
}