我创建了一个内联网络 worker
,如下所示:
var blob = new Blob([document.querySelector("worker").textContent]);
var worker = new Worker(window.URL.createObjectURL(blob));
但是我收到错误:
Cannot read property 'textContent' of null
我错过了什么?
最佳答案
您的 querySelector
模式与任何内容都不匹配。
我认为你应该将其更改为:
document.querySelector("#worker") // <- Added # to match the id
关于javascript - 内联网络 worker : Cannot read property 'textContent' of null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21403167/