Questions tagged [web-worker]

Questions with this tag should be about the "Web Workers" technology. Workers provide a simple means for web content to run scripts in background threads. Once created, a worker can send messages to the spawning task by posting messages to an event handler specified by the creator.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
33 views

Web worker as type module fails to load module script

I have the worker helper in react called workerBuilder.js: export function getWorker(worker) { const code = worker.toString(); const blob = new Blob([`(${code})()`]); return new Worker(URL....
strangeQuirks's user avatar
0 votes
0 answers
13 views

Import module in WebWorker with Electron

In a React (CRA) application I have created a WebWorker that imports node_modules as well. When developing the application I can load the modules. But when I have build the application the modules in ...
controlol's user avatar
1 vote
1 answer
41 views

Web Worker doesn't seem to be working on Production

I have been trying to use web worker on my React application, and pretty much succeeded in doing so locally. But, after deploying it to docker-container and EC2 instance afterward, I'm getting the ...
ristol's user avatar
  • 11
0 votes
1 answer
39 views

Are worker gems like Sidekiq still needed for a basic Rails application

Starting from Rails 7.1, Puma will automatically spawn x worker threads where x is the amount of available processors. This brings up the question on how to handle workers in a simple dockerized Rails ...
Kalsan's user avatar
  • 874
1 vote
0 answers
35 views

How to integrate OffscreenCanvas in dygraph with web worker

Pure canvas can handle with OffscreenCanvas and web worker technology. <!-- index.html --> <canvas id="mainCanvas" width="300" height="150"></canvas> //...
Jimmy's user avatar
  • 43
0 votes
0 answers
18 views

How to compile a .ts file to .js in a Next.js project (to use it as a Web worker)?

I have a TypeScript Next.js project: "scripts": { "dev": "next dev", "build": "next build", "start": "next start", ...
porton's user avatar
  • 5,338
0 votes
1 answer
20 views

Realtime encoding `MediaRecorder` stream to `mp3`

I want to realtime encode MediaRecorder stream to mp3. Currently I am saving stream from MediaRecorder as a blob variable. After the recording is done, I am converting the blob to wav and after that I ...
CZ workman's user avatar
7 votes
1 answer
82 views

PWA notification how to redirect to installed app if it exists

This seems fairly basic however I can't find an answer on here. The MDN official docs show that getting a notification to navigate back to the app should look like this: self.addEventListener("...
George's user avatar
  • 3,643
0 votes
1 answer
31 views

Web Worker Offscreen Canvas toBlob latency

I have a hidden canvas in a react app that I send to a web worker using transferControlToOffscreen (code). Everything is working, but after updating the canvas (fillRect for example) the worker ...
Micah's user avatar
  • 29
0 votes
0 answers
17 views

How do you pass information to a Checkout UI Extension (on a web worker)

I am using Shopify's Checkout UI Extensions to setup loyalty. I need to make an API call to verify a user has points before a purchase is made. So I am intercepting the buyer's journey in the cart if ...
Marco Chavez's user avatar
0 votes
0 answers
25 views

Constant stack size in Chrome Web Worker despite varying --js-flags stack size arguments

I am using the following code to estimate the size of the stack inside a Web Worker in Google Chrome running on Linux (x86_64): var i = 0; function recurse () { i++; recurse(); } try { ...
mallwright's user avatar
  • 1,803
0 votes
0 answers
18 views

Service Worker is not working in my angular 14 version

I Integrate ,service worker in my angular version 14, it will not working I got an console error main.e5bc1c66576092c1.js:1 Service worker registration failed with: Type Error: Failed to register a ...
ranjith a's user avatar
1 vote
0 answers
37 views

put mapbox-gl in a worker and read with readpixels() to encode in the main thread

This is the first time I've asked a question on Stackoverflow and it's because I really got stuck. I have an animation in mapbox, which runs on the same thread as the h264-mp4-encoder video encoder. ...
palomino's user avatar
1 vote
1 answer
50 views

Does terminating a web worker also terminate any child workers it spawned?

The spec seems to indicate that it doesn't, but if I'm reading it correctly that seems like a pretty severe bug? It could lead to isolated workers wasting computational resources indefinitely, without ...
Isaac King's user avatar
0 votes
0 answers
63 views

Maintaining Server-Sent Events (Azure/fetch-event-source) during Mobile Web User Inactivity

I'm working with Server-Sent Events (SSE) using the Azure fetch-event-source library for my react web app that has a retry interval of 30 seconds. Everything works great when the user is on the mobile ...
JasonChee's user avatar
0 votes
0 answers
33 views

How to keep javascript setTimeout running when user minimizes the browser on mobile

I have a countdown timer on my website. I ran into an issue where if the user switches tabs for too long the timer becomes out of sync with real time. I fixed this issue by running the timer in a web ...
itsDanial's user avatar
  • 115
2 votes
1 answer
36 views

How to deal with vite "?worker" imports, so that VSCode is happy?

I have a Typescript based, Vite based frontend project, that makes used of Web Workers and has an import of the style: import MyWorker from './workers/MyWorker?worker'; The problem, in VSCode, the ...
Andre M's user avatar
  • 6,836
2 votes
1 answer
144 views

Using OPFS (Origin Private FileSystem) with SQLite WASM in background.js Chrome Extention (Worker is not defined error)

I'm trying to get persistent storage working with WASM SQLite. My code in the background.js file is this const worker = new Worker('./worker.js'); worker.postMessage({ loadSQLite: true }); But it ...
Joseph Astrahan's user avatar
0 votes
0 answers
35 views

Is there any way to safely execute user's Javascript with pre-defined object & functions?

Our web application is a mobile app builder. You can imagine it's like Wordpress, but the output are mobile apps. Inside the web app, we have a feature that take in user's Typescript (through Monaco ...
newbeeinthehouse's user avatar
0 votes
0 answers
49 views

Inlining a typescript-defined web worker in an Angular application

In an Angular 16 application bundled with webpack 5, I want to inline a web worker. Ideally with webpack 5, but webpack 4 would also work for now. I instantiate the web worker with a typescript file ...
JoeCool's user avatar
  • 129
1 vote
2 answers
80 views

chess engine keeps calculating old fen position once a new fen is given

I'm trying to create a chess engine eval bar for React. For this I've added stockfish.js to my project and using the web worker api, initialized the engine inside a useEffect that gets re-rendered ...
Daniel Mohebi's user avatar
1 vote
1 answer
101 views

Slow vector tiles off screen canvas rendering with Openlayers

There's an example on Openlayers website: https://openlayers.org/en/latest/examples/offscreen-canvas.html It works fine but when I try to add an additional tile layer (XYZ or WMS) to the map, the ...
koalex's user avatar
  • 13
0 votes
0 answers
64 views

How do I use Worker with app router in Next.js?

I am attempting to use Worker in app router for Next.js, but so far not getting expected results. Essentially this is the code: import Worker from 'web-worker'; export async function GET(request: ...
fursund's user avatar
  • 51
0 votes
0 answers
31 views

plotly scatter chart plotting x

I am attempting to create a scatter chart using Plotly, where I need to display 60 traces, each with around 1000 data points. The data arrives approximately every 100ms. I have implemented a web ...
Prateek Upadhaya's user avatar
0 votes
1 answer
58 views

How do i cancel a javascript interval set in a worker thread

I have worker thread set up like this: var worker = new Worker('thread_1.js'); In thread_1.js I have an interval set up to post a message back to the main thread every 3 seconds like this: onmessage =...
John's user avatar
  • 1,330
0 votes
0 answers
39 views

Uncaught (in promise) DOMException: Failed to register a ServiceWorker

I'm trying to register a Service worker to manage push notification. Everything works perfectly in Mozilla but in Chrome it fires the error Uncaught (in promise) DOMException: Failed to register a ...
NicoCaldo's user avatar
  • 1,265
0 votes
0 answers
16 views

How to import three.js/some-other node package/lib/module in web-worker.ts file in angular application?

Web worker has this in first line (as it got generated when I've added with ng generate web-worker app) /// (First line in web-wroker.ts file) Tried adding threejs import like this /// and also ...
Karunaker Reddy V's user avatar
0 votes
0 answers
47 views

Using react-use-websocket inside of a Web Worker (Comlink)

I have a websocket that sends and receives data and I want it to be running in a different thread. The thing is, I'm using react-use-websocket which is a react custom hook and I need to run that in a ...
Sathish's user avatar
1 vote
0 answers
20 views

Is Webworker necessary in my case ? Websocket returns array of over 50,000 elements to be rendered in React

Question, is webworker for websocket needed in my case? Currently, I have a custom React hook that creates a websocket instance, this websocket will continuously fetch over 50,000 elements which is ...
samplecode3300's user avatar
0 votes
0 answers
22 views

AWS ElasticBeanstalk Worker enviornment, how to redirect SQS POST request to another port other than 80

I have a NestJS application running on an Elastic Beanstalk worker environment. The application is written in Javascript and not in Typescript. So it cannot be built using the nest build command. ...
Parag Pawar's user avatar
1 vote
0 answers
198 views

Vite: Get URL for separate module bundle so that it can be dynamically imported by a Worker

Question I am creating a library that runs mainly in Web Worker (although it can also be run in the Main thread as well). I want the app that is using my library (let's assume they build their app ...
Frank Weindel's user avatar
0 votes
0 answers
66 views

Call a function from local module in a webworker in Angular

So, I encountered a situation where I did not find many valuable resources. I have a function called local_module_add_one; it takes a number and returns its incremented value. This function is part of ...
alpha027's user avatar
  • 302
0 votes
0 answers
23 views

How to play video from web worker [fix invisible tab - playing video]

How to play video from a web worker? The only info that I found was https://developer.mozilla.org/en-US/docs/Web/API/MediaSourceHandle It is experimental [no problem] but the example is not fully ...
Nikola Lukic's user avatar
  • 4,071
0 votes
0 answers
17 views

How can I deploy my webworker to Firebase on my Ionic React App?

I have a fairly simple react app in which I'm using a webworker to do some stuff on the background process some data send it back to the main thread where the component is being rendered and updates ...
Claudio Vasquez Nimbus V's user avatar
0 votes
0 answers
89 views

Constructing a Worker with a string literal is not supported

I'm constructing a worker like this: state.worker = new Worker( "../../services/timeTracker/trackTimeWorker.js" ); Using Plasmo want to build an extension off my vue project. But I keep ...
temp's user avatar
  • 517
0 votes
0 answers
39 views

How to clear the Webworkers Message Queue

I have a computationally expensive Webworker that is supposed to only work with the most recent data that was sent as a Message: let nextEventData = null; self.addEventListener("message", (e)...
MyNameIsFu's user avatar
0 votes
0 answers
27 views

Is it necessary to use "self" property in a web worker?

I am new to "Web Workers" API. I was reading this tutorial to learn about it. In one part of it, we have these codes for a "worker" called "fibonacci.js": self....
hamid-davodi's user avatar
  • 1,762
0 votes
0 answers
59 views

Javascript Tamagotchi on Background - JS worker and/or options

This is my first time-ever question on here so I hope I am doing this correctly. I can write and read html/css and my javascript is quite basic, I think. I use codepen to find scripts and adjust them. ...
Manouk Iris Hanning's user avatar
2 votes
0 answers
196 views

Is there a way to use Tauri's `invoke` function in a web worker?

I want to know if it is possible to run invoke from Tauri, in a web worker. I am using Tauri and Svelte. When I try to use invoke from a web worker, I get this error: chunk-NMUKSDLG.js:1 Uncaught ...
Fighter178's user avatar
0 votes
0 answers
59 views

read otp from phone and submit to website on desktop

How can we send OTP received on android to website like paisabazaar.com How paisabazaar.com works Login to paisabazaar.com using mobile no You get an OTP When you receive OTP a popup is shown (see ...
Kalpesh's user avatar
  • 93
0 votes
0 answers
14 views

How can we initiate more than 6 HTTP connections with web worker in Angular14?

I am using web worker to upload files parallelly. Once the user uploads files I am iterating over the for loop and create a worker for each file. I am not facing issues while creating multiple workers....
Shriram's user avatar
  • 141
0 votes
0 answers
46 views

not able to use web worker

I am in React project but not one created using create-react-app. I am trying to start playing with web worker but i am so lost in the basic process. This is my project directory where my file is ...
Pravin Poudel's user avatar
0 votes
1 answer
175 views

Create HTMLImageElement in web worker

I am trying to use OpencvJs as a web worker. but imread function of ovencvJs needs HTMLImageElement as a param. opencv.imread(image); in the main thread, I was creating with the following code: ...
Shashank Padwal's user avatar
0 votes
1 answer
116 views

Image pixel manipulation in a dedicated web worker

I need to do a computation intensive image pixel manipulation in a browser using JavaScript. Pixel manipulation includes histogram equalization, converting to grayscale using lightness (L* of CIE Lab ...
Eugene Khyst's user avatar
  • 9,495
0 votes
0 answers
34 views

Problem with converting audio with Opus-Recorder within Angular

I need to convert opus audio on-the-go to something else because the delightful developer experiencie that Safari and iOS always make sure that happen. The opus-recorder library is the best one that I’...
Khael Bubniak's user avatar
0 votes
0 answers
10 views

web worker don't work when trying a simple use

my 'main' code is this: useEffect(() => { if (menu == 'Simulate') { let props = { nodes: nodes, edges: edges, } let newProps = JSON.stringify(props); ...
Nicolas Jorquera Martinez's user avatar
3 votes
0 answers
257 views

RUST/WASM threads in a browser

When a web app runs multi threaded WASM code (compiled from RUST), the web app will use web worker for the threads while RUST (compiled to native executables outside of the browser) is using native ...
Yaron Naveh's user avatar
  • 23.8k
2 votes
0 answers
44 views

Chrome Extension doesn't expose web_accessible_resources file for creating Worker

I have an extension that injects a script to a page (through activeTab and scriptings APIs). The script also starts a Worker with the code provided by the extension and it's declared inside ...
Luke Vo's user avatar
  • 18.6k
0 votes
1 answer
100 views

Is it possible to create shared worker from a string and to use it without sharing the worker URL?

Probably this is not possible but I would be glad to hear about alternatives. I have a large JS script which I want to run in a SharedWorker, but without uploading it to a server before running (it's ...
Maz's user avatar
  • 81
1 vote
0 answers
235 views

Using Vite React with C++ Emscripten + Multithreaded Web Workers

I'm trying to setup a project using Vite React + C++ code compiled with Emscripten with multithreading via web workers enabled. This works fine with a development build using npm run dev but fails ...
Meowfueille's user avatar

1
2 3 4 5
45