-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Description
I am wanting to develop modular service workers and I would like to continue using typescript and AMD modules to do it:
declare var requirejs: Function;
self.importScripts("../static/almond.js");
requirejs(["serviceworker/index"], (worker: { run: (worker:any) => void }) => worker.run(self));
The above results in the following error:
Event handler of 'fetch' event must be added on the initial evaluation of worker script.
The problem, I think, is the setTimout in following code in almond.js:
//Simulate async callback;
if (forceSync) {
main(undef, deps, callback, relName);
} else {
setTimeout(function () {
main(undef, deps, callback, relName);
}, 4);
}
I tried forcing forceSync to be true but ran into other problems. All the modules are in one concatenated filed thanks to the typescript compilers "outfile" option. Any guidence of possible code changes to allow almond to be used as a service worker loader?
Metadata
Metadata
Assignees
Labels
No labels