Web工作者和访问连接到窗口对象的对象 [英] Web workers and accessing object attached to the window object
问题描述
window.App = Ember.Application.create({} );
我想在web worker上做一些后台处理。
如何在单独的web worker线程中访问窗口对象或某个其他全局对象?
<简答。您不能。
Web工作人员可用的唯一资源是使用 importScripts()$ c $从JavaScript文件加载的资源c>或任何通过
sendmessage()
传递给它们的任何东西。
此外,Worker不能访问本地存储。
I have an ember application that I create like this:
window.App = Ember.Application.create({});
I want to do some background processing on a web worker.
How can I get access to the window object or some other global object in the separate web worker thread?
Short answer. You can't.
The only resources available to web workers are that which they load from JavaScript files using importScripts()
or anything that is passed to them via sendmessage()
.
You can however now pass Objects to them. They are serialized and de-serialized to JSON automatically.
Also, there is no access to local storage from the Worker.
这篇关于Web工作者和访问连接到窗口对象的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!