From d8edb51d6afbda3bd4e2512e378d9db8135c6ded Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 9 Apr 2020 19:18:48 +0800 Subject: [PATCH] add explanation why we need a custom binding --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 73ab40b..5d8e2d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,6 +47,10 @@ fn build_routes() -> router::Router { #[wasm_bindgen] extern "C" { + // This binds to the fetch function in global scope + // In cloudflare workers, there's no Window object + // and unfortunately the bionding in web_sys depends + // on Window being present. fn fetch(req: &Request) -> Promise; }