Hi,

We have a little project that we've run through emscripten and it produces 
an asm.js output called example.js, and example.js.mem. Inside example.js 
is the generated function fetchRemotePackage(), which uses XMLHttpRequest 
(XHR is also used elsewhere in example.js).

I've tried to use this in my Service Worker, starting simply with 
importScripts('example.js'). Unforturnately both Chrome and Firefox return 
a ReferenceError stating that XMLHttpRequest is not defined. It seems that 
Service Worker does not support XHR and it would rather I use the WHATWG Fetch 
API <https://fetch.spec.whatwg.org/>. Note that this is seems to be 
completely distinct from Emscripten's Fetch API.

I wondered if this issue with Service Worker was already on Emscripten's 
radar, a search did not yield much. I also had a look if there was some 
kind of build option that would replace XHR with Fetch but did not have 
much luck.

I suppose I could manually transform the generated code with --js-transform 
but that does not seem ideal, especially since the problem is so broad as 
to affect all Service Workers.

Any tips?

Kind regards
Lucas


-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to