I want to use YUI inside of a WebWorker thread. Flickr recently wrote a post on this very topic, Web workers and YUI.
But I want to use YUI's CDN, which WebWorkers prevent because it enforces a same-origin policy with importScripts()
Two options:
Option A) Host YUI yourself. Boooo.
Option B) This script demonstrates a proof-of-concept technique that uses:
- Y.Loader to generate the module URL(s)
- Y.YQLRESTClient to fetch each URL
- Y.Async to handle the queue
- BlobBuilder to create a single blob of all scripts combined
- createObjectURL to hand off the blob to the WebWorker
Credit to solmsted in #yui for original script (http://jsfiddle.net/uqt5c/)
Prettied by dgathright