web-worker

Cross Domain Web Workers

六眼飞鱼酱① 提交于 2019-12-12 02:46:41
问题 I am aware that this question might be considered duplicate, but it is a new technology and I can not find a recent confirmation of my findings. I also think it potentially useful to have all the error messages in one place (feel free to add any other browsers). trying to loads a worker script from another domain: new Worker('http://otherdomain.co/worker.js'); I have set headers (using ModHeader Chrome Extension) to: Access-Control-Allow-Methods:* Access-Control-Allow-Origin:* But in Chrome I

Javascript - How can I pass a jQuery object (table) to a web worker?

大憨熊 提交于 2019-12-12 00:34:36
问题 I have an HTML table with different columns and rows. The table can be edited inline by a user. When a user edits the table, I calculate some sums on the rows of table. The function that calculates the sums was in the main script and took a lot of time making the browser unresponsive. To solve this performance issue, I have created a web worker in JavaScript to calculate the sums on the table. The problem is that the web worker cannot access the DOM. I'm looking for a way to pass a jQuery

General solution for pre-emptive background work scheduling on javascript

半腔热情 提交于 2019-12-11 14:59:45
问题 Here is the scenario: When my web app starts, I want to load data from several tables in local storage (using indexedDB). I delegate this work to a web worker. It will load each table in turn, and fire a message with the data as it loads each one. On the main thread, a listener will receive the message and store the data in a cache. But let's say the user presses a button to view the data for a specific table. The app calls a function that checks the cache, and sees that the data for that

Does react-native-webview can perform webrtc call audio + hot keywords speech to text detection using my own js code?

梦想的初衷 提交于 2019-12-11 14:09:37
问题 I have developed a js code capable to perform a webrtc audio call only in combination with pocketsphinxjs for hot keywords speech detection. I've merged this hot keywords speech to text detection demonstration (which use a 3 old year version of pocketsphinxjs) with this webrtc call audio only and this audio visualiser, with the following modifications : I have moved the two AudioContext() constructor calls in just one (and gives it as a parameter when needed), after the getUserMedia() success

Sending messages from SharedWorker to SharedWorker

余生颓废 提交于 2019-12-11 12:29:41
问题 The MDN Documentation on SharedWorkers states: The SharedWorker interface represents a specific kind of worker that can be accessed from several browsing contexts, such as several windows, iframes or even workers . To me this sounds as if SharedWorkers should be able to directly exchange messages. However, if I try to access a SharedWorker from within another SharedWorker, namely with var worker = new SharedWorker("path/to/file.js"); I get ReferenceError: SharedWorker is not defined Did I

Use Web Worker to getImageData from a file

时光毁灭记忆、已成空白 提交于 2019-12-11 11:51:54
问题 Is it possible to decode the image data from a file in a Web Worker so that I can pass it to the main thread and use putImageData. This is presumably faster than just calling drawImage. 回答1: Yes it is. The WebWorker API specification allows you to simply postMessage ImageData and ArrayViews to and from it. However, not all implementations currently have this enabled afaik. You may want to have a look at this video from JSConf'11 that also touches this topic. That beeing said, putImageData is

How to import a typescript module inside a Web Worker in angular 8?

∥☆過路亽.° 提交于 2019-12-11 10:02:31
问题 Since Angular 8, you can now generate web worker to your app from the CLI. I did so exactly like the official guide: https://angular.io/guide/web-worker And it works perfectly. But as soon as I try to import any module to the top of app.worker.ts with: import { MyData } from '../shared/shared.module'; Then I get compile errors: Is there any other way to import modules into web workers? 回答1: My problem was that this shared module I was trying to import was created with ng generate module . In

Access to the Indexed Database API is denied in this context

大兔子大兔子 提交于 2019-12-11 07:36:12
问题 I'm getting an exception when I try to access IndexedDB in Chrome with Service Workers. I'm not using a web server so I execute my html files locally onto browser so my url is something like file:///D:/Dev/web/sample-sw/index.html I don't know why the code works on Firefox but it doesn't on Chrome. This is the exception: Unhandled rejection: OpenFailedError: SecurityError Failed to execute 'open' on 'IDBFactory': access to the Indexed Database API is denied in this context. My index.html is

How to wrap Web Worker response messages in futures?

♀尐吖头ヾ 提交于 2019-12-11 06:19:46
问题 Please consider a scala.js application which runs in the browser and consists of a main program and a web worker. The main thread delegates long running operations to the web worker by passing messages that contain the names of methods and the parameters required to invoke them. The worker passes method return values back to the main thread in the form of response messages. In simpler terms, this program abstracts web worker messaging so that code in the main thread can call methods in the

Shared worker is teminated on reloading page

一笑奈何 提交于 2019-12-11 04:34:53
问题 Why is Shared Worker dead on reloading page? It must've revived. How can I fix this issue? Before reloading After reloading (Press F5 on example.com) Parent worker var port = new SharedWorker('/app/worker-5n1261e73b.js').port; port.onmessage = function(e){ console.log(e.data); }; port.start(); worker-5n1261e73b.js onconnect = function(e){ var port = e.ports[0]; port.onmessage = function(e){ console.log(e.data); }; port.start(); port.postMessage('Connected'); }; 来源: https://stackoverflow.com