I'd like to be able to use a number of utility methods from jQuery in a Web Worker, where there is no access to the window
or document
objects.
Specifically, I'd like to be able to use methods like $.extend()
, $.ajax()
, and the entire $.Deferred()
system. I obviously would not need any of the DOM traversal and manipulation methods, so I'm not looking for a solution like JSDOM.
I can extract the non-DOM portions of jQuery myself, but this is a pain to maintain. Are there any available distributions or build scripts for jQuery that just build the non-DOM portions?
My answer: https://github.com/kpozin/jquery-nodom.
So far, I have it working and tested with $.Deferred()
and a subset of $.ajax()
inside of a Web Worker context. Documentation and possible test suites coming later.
An initial test build is available: jquery.nodom.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With