I need to do some computationally intensive stuff in the background of my app and I've been learning about HTML5 Web Workers. Is there an integrated way to do this with Google Closure Tools? I found gears.Worker but it isn't clear to me whether this class fits the bill nor how to use it. Thanks!
Using Web Workers do not need anything special from closure library, except if you want to run without compilation bootstrap/webworkers.js will help. It is used like this
/**
* Closure dependency management, require only main worker script of un-compiled version.
*/
if (typeof COMPILED == 'undefined') {
CLOSURE_BASE_PATH = '../../../closure-library/closure/goog/';
importScripts(
CLOSURE_BASE_PATH + 'bootstrap/webworkers.js',
CLOSURE_BASE_PATH + 'base.js',
CLOSURE_BASE_PATH + 'deps.js',
'/your-script.js');
}
gear
is used before web storage. I guess it is not very good and ugly.
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