想利用WebWorker实现js的多线程。
代码如下:
$(document).ready(function(){
if(typeof(Worker)!=="undefined")
{
var Worker = new Worker("js/adjs.js");
}
else
{
alert("浏览器不支持Web Worker");
}
})
但总是提示找不到Worker构造器:
Uncaught TypeError: Worker is not a constructor
at HTMLDocument.<anonymous> ((index):30)
at j (jquery-1.11.2.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.2.min.js:2)
at Function.ready (jquery-1.11.2.min.js:2)
at HTMLDocument.J (jquery-1.11.2.min.js:2)

有没有大佬知道为啥
代码如下:
$(document).ready(function(){
if(typeof(Worker)!=="undefined")
{
var Worker = new Worker("js/adjs.js");
}
else
{
alert("浏览器不支持Web Worker");
}
})
但总是提示找不到Worker构造器:
Uncaught TypeError: Worker is not a constructor
at HTMLDocument.<anonymous> ((index):30)
at j (jquery-1.11.2.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.2.min.js:2)
at Function.ready (jquery-1.11.2.min.js:2)
at HTMLDocument.J (jquery-1.11.2.min.js:2)

有没有大佬知道为啥
