how to include javascript files in Google Gears Worker (no DOM access)

307 Views Asked by At

how does one include other .js files in the .js of a Worker. Every "include" solution for Javascript that I've found does it by loading into a tag, which is not an option for Workers since they don't have access to the DOM.

I see from your 950087/include-javascript-file-inside-javascript-file that using Ajax and eval() will do it. I can figure that out but please point me to reference implementation if there's an easy one.

Someone proposed WorkerPool.load() back in 2007 here http://code.google.com/p/gears/wiki/NewWorkerPoolFeatures?redir=1 . Was anything like that ever done?

2

There are 2 best solutions below

0
On BEST ANSWER
0
On

HTML5 Workers (as supported by Safari 4 and Firefox 3.5) has the importScripts function -- presumably Gears also supports it.