Description
Currently, the core "standalone" Infusion framework can't be run in a Web Worker. This is due to the fact that we've still got a few stray references to the the global "window" variable in the code. In a Worker, there is no window, but the "self" variable is the equivalent global (with some of same functions available).
My worker includes the following portions of the Infusion core framework:
- jquery.standalone.js
- Fluid.js
- DataBinding.js
- FluidDebugging.js
- FluidIoC.js
Here's a list of the references to "window" that cause failures in a Worker:
https://github.com/fluid-project/infusion/blob/master/src/framework/core/js/Fluid.js#L45
https://github.com/fluid-project/infusion/blob/master/src/framework/core/js/jquery.standalone.js#L34-L36
I also noticed that this function will pass in a Worker when its argument is "self" (which is probably a good thing):
I was able to quickly hack up a fix for this issue while testing. For reference, here's the diff:
https://gist.github.com/colinbdclark/3fbfa7e82b85cb9915fa
This, of course, still needs to be worked up into a viable pull request.