简体   繁体   English

如何在Google Gears Worker中包含javascript文件(无DOM访问权限)

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

how does one include other .js files in the .js of a Worker. 如何在Worker的.js文件中包含其他.js文件。 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. 我发现的每个Java的“包含”解决方案都是通过将其加载到标记中来实现的,对于Workers来说这不是一个选择,因为Workers无法访问DOM。

I see from your 950087/include-javascript-file-inside-javascript-file that using Ajax and eval() will do it. 我从您的950087 / include-javascript-file-inside-javascript-file中看到,使用Ajax和eval()可以做到。 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 . 有人在2007年在这里http://code.google.com/p/gears/wiki/NewWorkerPoolFeatures?redir=1提出了WorkerPool.load()的建议。 Was anything like that ever done? 有没有做过这样的事情?

HTML5 Workers(受Safari 4和Firefox 3.5支持)具有importScripts功能-大概Gears也支持它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM