web-worker

Web Worker in cordova - is it supported

心已入冬 提交于 2019-12-24 10:13:07
问题 I can't seem to get my cordova app to execute even a simple web worker, even though the same web worker works in the Chrome browser on the same device. (Android device, Google Pixel 3, running Android 9, latest patch level. The app was built in PhoneGap build with cli-8.0.0 ) Setup in the main thread: const worker = new Worker('/fake.worker.js'); worker.postMessage(1337); worker.addEventListener('message', event => console.log("[myWorker] received event from myWorker:", event)); And the /fake

Error cloning element from scope while using Angular and Web Workers

只谈情不闲聊 提交于 2019-12-24 08:27:18
问题 I have an Angular app and I'm trying to implement some functionality into a Web Worker. To achieve this I need to pass an object from the angular scope to the worker so it's processed and a result is generated. I run into the following error: Error: Failed to execute 'postMessage' on 'Worker': An object could not be cloned. When calling worker.postMessage($scope.scopeObj); Is there something special I have to do in order to send that object to the worker? It currently works with mock objects

Can I use WebWorkers in AWS Lambda (node 6.10)

爷,独闯天下 提交于 2019-12-24 08:09:40
问题 I've got a very simple node module that I want in AWS lambda, and its importing 'Natural' for some text processing. This line throws the error: var n = require('natural'); The error is this: { "errorMessage": "/var/task/node_modules/webworker-threads/build/Release/WebWorkerThreads.node: invalid ELF header", "errorType": "Error", "stackTrace": [ "Module.load (module.js:487:32)", "tryModuleLoad (module.js:446:12)", "Function.Module._load (module.js:438:3)", "Module.require (module.js:497:17)",

Webworker served from the local filesystem not working

╄→гoц情女王★ 提交于 2019-12-24 07:52:56
问题 I am trying to make the web worker example from MDN to work when it is not served from a server but opened directly open from my local filesystem (via a via file:// URL) The example works fine when served from Apache at http://localhost/1/simple-web-worker-gh-pages/index.html but it doesn't when it is read locally at file:///var/www/html/1/simple-web-worker-gh-pages/index.html The developer console shows that messages are posted but there is no answer from the worker. (I tried both Firefox

Angular 2 Web Worker - UI not running

余生颓废 提交于 2019-12-24 03:31:23
问题 I've got an angular2 application running in a web worker. By the looks of it, everything is running as I would expect, but nothing seems to be happening with the DOM. For example, I show a pre-loader while the app is loading, but it never gets replaced with the actual application UI. <my-app>Loading...</my-app> When the AppModule loads, nothing renders in my-app... even though I see all my components and services running exactly as I would expect inside the background worker... the whole app

Are Shared WebWorkers supported in IE 11?

纵饮孤独 提交于 2019-12-24 00:58:05
问题 I tried to implement this code, here is the link. It works in Chrome, whereas in IE 11 it gives an error 'SharedWorker' is undefined . But according to caniuse, WebWorkers are supported in IE 11. Does anyone know who is right? 回答1: Web workers are indeed supported in IE 11, but shared workers not. From MDN: 来源: https://stackoverflow.com/questions/44708277/are-shared-webworkers-supported-in-ie-11

Loading texture from Web Worker in Three.js

为君一笑 提交于 2019-12-23 16:36:50
问题 When applying a large texture image to a Mesh for a noticeable period of time Three.js locks-up browser's main thread. Let's consider the following example: var texLoader = new THREE.TextureLoader(); texLoader.load('someLargeTexture.jpg', function(texture) { var geometry = new THREE.SphereGeometry(10, 32, 32); var material = new THREE.MeshBasicMaterial({map: texture}); var sphere = new THREE.Mesh(geometry, material); // adding the object to the scene will lock up the browser's main thread

FormData in a webworker - in some browsers - is this wrong?

我的未来我决定 提交于 2019-12-23 13:00:43
问题 I have been playing with uploading inside a webworker, and found things working in Chrome. However, in Safari and Firefox, I get FormData is undefined. I found out that this is fine and to be expected: as mentioned in https://stackoverflow.com/a/13970107/1238884 FormData is not defined / supported for webworkers and implements a polyfill. (note: updated polyfill @ https://gist.github.com/Rob--W/8b5adedd84c0d36aba64) But why does it work in Chrome (v39)? Does it have a buggy implementation, or

Pass submited file to web worker by refference with as little overhead as possible

走远了吗. 提交于 2019-12-23 12:39:07
问题 I will have a web worker to parse huge text file (200000 lines, simple syntax though). I expect user to submit that file wia drag'n'drop or otherwise, obtaining a File object: var work = new Worker("parser.js") document.addEventListener("drop", function(e) { e.preventDefault(); var dt = e.dataTransfer; var files = dt.files; if(files.length>0) { var firstFile = files[0] var reader = new FileReader(); //SEND FILE TO WORKER? } }); I heard of Transferable objects. Is there a way to transfer file

What local storage in html5 can I use safely in the browser ui thread and the web worker thread

亡梦爱人 提交于 2019-12-23 09:32:24
问题 I've been trying to use web sql database api in webkit based browsers. I have been using the async api in the main ui thread and a web worker . Both threads access the same database (which as you know is sqlite underthehood) Everything behaves fine but occassionally transactions are lost or one transaction fails and it seems to be a timing/race condition. It appears access to the underlying sqlite database is not thread-safe. A bit more background. My web worker is simply executing a query