2,284
questions
0
votes
0
answers
13
views
How to test async worker threads with Node.js built-in test runner?
I am using an async function to pass work into a Web Worker. For the purposes of testing, I am substituting the Web Worker API with Node's worker_threads module if not in a browser environment. The ...
0
votes
1
answer
57
views
Struggling to draw SVG onto an offscreen canvas in a web worker
I've been working from zero experience of web workers to now for longer than I'd like to admit and it has me defeated.
I want to move a long task, canvas.toBlob(/* jpeg stuff */) to a worker but ...
0
votes
0
answers
20
views
How to use [email protected] library for Clientside DOM manipulation in web worker?
I am currently try to optimize many-many html dom manipulation in frontend without using server due to small size of the server as well. I am interested to use this worker dom library tutorial to ...
1
vote
0
answers
25
views
How to Set Up Sentry in Next.js Using a Web Worker to Avoid Main Thread Impact?
I’m working on a Next.js project where I want to set up Sentry for error tracking without impacting the Total Blocking Time (TBT) and main-thread performance. I’ve tried moving Sentry operations to a ...
0
votes
1
answer
40
views
How to use the cloudflare worker cache as a fast KV?
I cant seem to get the Cloudflare cache working as described in the Cloudflare documentation https://developers.cloudflare.com/workers/runtime-apis/cache/
I am trying to use Cloudflare worker cache as ...
0
votes
0
answers
29
views
How to send push notifications or keep WebSocket active when a browser tab becomes inactive or snoozed in Vue.js?
I have a web dashboard built using Vue.js that relies on WebSockets (Pusher) to receive orders in real-time. When an order is received, a sound plays to notify the user. Everything works fine when the ...
0
votes
0
answers
20
views
setup to get the python output displayed line by line during execution
I am working on building a web application that runs Python code in the browser using Web Workers and Pyodide. My goal is to display the output line by line in the browser/application as the code is ...
1
vote
0
answers
25
views
Web workers in React app randomly crash with a canceled chunk.js error
setting
I have a React app (using create-react-app) that utilizes web workers for multithreading. The main worker spawns multiple child workers, up to the number of CPU cores minus one, to perform ...
-1
votes
0
answers
26
views
Reading from a ReadableStreamDefaultReader of transferred WebTransportReceiveStream (ReadableStream) to worker leads to DataCloneError
After trying a similar example to what is found at whatwg, both Firefox and Chrome fail at reader.read() with a DataCloneError: A ReadableStream could not be cloned because it was not transferred. on ...
0
votes
1
answer
43
views
WebAssembly exported function: Cannot read properties of undefined
I'm trying to run lightningcss on a WebWorker module for my JavaScript application.
I imported it as a module as follows:
import * as lightningcss from './index.mjs';
and tried using the function as ...
1
vote
0
answers
49
views
Chartjs: chart is blurry when using webworker
I am trying to use chart.js with webworker.
I am able to create the webworker and show the chart on the screen with the right dimensions.
The problem is: the chart is blurry and a bit "zoomed in&...
0
votes
1
answer
59
views
problem opening Sqlite3 database from JavaScript Web Worker
I'm trying to insert data from an Sqlite3 database into a web page hosted by a Beaglebone black.
Using a JavaScript web worker form an on line example for a number count, the JS worker and HTML page ...
0
votes
1
answer
52
views
How to ensure web worker process only last message?
I have a scenario where it might happen that user produces events rapidly (hovers, e.g.). Each hover sends a message to web worker to do some calculation.
Each new message should cancel the previous ...
1
vote
1
answer
110
views
After trying to migrate a project from Webpack to Vite, JS code fails to execute
There was a Webpack configuration that I used to build a separate bundle for a JS worker (it must be in a separate file) and everything worked well. Here is the webpack config:
const path = require('...
0
votes
0
answers
38
views
Mistmatching Checksums between CPP client and Cloudflare Worker
I'm trying to upload a file to cloudflare from an embedded device.
There a C++ application that generates a SHA-1 checksum before uploading the file
std::string generate_checksum(const std::string&...
0
votes
0
answers
56
views
Possible to have WorkerGlobalScope.crossOriginIsolated == true when browser tab's top level window.crossOriginIsolated == false? If so, how to do?
I am trying to use SharedArrayBuffer, which requires the COOP and COEP headers to be set so that window.crossOriginIsolated==true.
I've done that, and it works fine. But for reasons I can't go into, ...
0
votes
0
answers
28
views
Memory limitations for web workers
I have spent a couple hours searching an answer for this, a simple I thought, question. Can't seem to find one. Is there any doc on that? Anyone can share anything about memory limitations for the web ...
0
votes
1
answer
45
views
Visibility of data in shared array buffer after using postMessage() with web worker
I am using a web worker to process some data for me. The flow goes like this: main thread writes to a shared array buffer, then once done writing, uses postMessage to send the buffer to the webworker. ...
0
votes
2
answers
94
views
Loading a worker script at build time in a Vite project
Is it possible to create define a web worker such that it does not have to load from an external file during runtime in a vite project?
I am building a browser that depends on a web worker file and I ...
0
votes
0
answers
36
views
Issues Testing Web Worker with Timers in Jest – How to Receive Correct Countdown Messages?
export const timerWorker = () => {
let timerStart = false;
let intervalId = null;
let timeLeft = 0;
self.onmessage = (e) => {
const { data = {} } = e;
const {...
0
votes
0
answers
29
views
How to write test file for count down timer react component in jest?
I tried to write the test for the countdown file using jest
This is my countdown file:
import React, { useEffect, useState } from 'react'
import _padStart from 'lodash/padStart'
import styles from './...
0
votes
1
answer
85
views
Creating a Typescript Project with Support for Web Workers?
I'm trying to create a Typescript project that supports web workers.
First I create a baseline that will compile typescript code like this.
mkdir ts
cd ts
npm init -y
npm i -D typescript
npm i -D @...
0
votes
0
answers
47
views
Adding the highlightjs API interface to self in a web worker?
I'm coding a web worker in Typescript and this works:
onmessage = (e) => {
importScripts(
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js'
);
const ...
0
votes
0
answers
52
views
Web worker only from the cache in Javascript
The stockfish chess engine is 64MB big.
I need to ensure that nobody downloads this over a network connection.
(only allow over wifi or ethernet)
I am running this code to check if the connection is ...
1
vote
0
answers
111
views
How to load an isolated JS module in Tauri?
I have a Tauri app (with Vite as the bundler) on which I want to give the users the possible to load small JS scripts. Ideally the user would just declare a index.js and I will just do a folder scan ...
0
votes
0
answers
34
views
Web worker inside react component causing race condition
I am trying to create a performant timer component in React.js (for learning purposes) and for that I am using web workers. The logic works as expected the first time when I click "Start" ...
0
votes
1
answer
46
views
Creating a web worker in a Stackblitz Lit Element Project?
I'm trying to create a web worker in a Lit Element Stackblitz Project.
This is the worker (worker.js):
onmessage = (e) => {
console.log(e.data);
postMessage(e.data);
};
And this is the code ...
0
votes
1
answer
47
views
How to ensure user logout with Web Worker when the computer goes to sleep
I’m using a Web Worker to set a setTimeout that automatically logs out the user after 10 minutes of inactivity. However, I’ve encountered an issue where if the user’s computer goes to sleep, all ...
0
votes
1
answer
74
views
Using Webworkers for both parallel rendering and data generation in Chartjs
I am changing from Dygraph to Chartjs because of rendering webworkers and wish to fully multithread the graph to keep main thread empty as much as possible. I am trying to use Workers for handling ...
0
votes
2
answers
99
views
Resolve blocking of main thread on heavy workloads [closed]
I am building a tiny library that interfaces with the Canvas API through functional means.
Some functions may take too long - either due to their complexity - or a programming error (infinite loop).
...
1
vote
1
answer
163
views
How does one get new URL() (for a web worker) that Vitest can recognise in a React integration test?
I instantiate a new web worker within one of my React components
const MyComponent = () => {
...
const worker = new Worker(
new URL('../../../path/to/my-worker.ts', import.meta.url)
...
-1
votes
2
answers
89
views
Why does new Worker('./worker.js') fail but new Worker(new URL('./worker.js', import.meta.url)) work?
When I try to new a Web Worker I find new Worker('./worker.js') fails but new Worker(new URL('./worker.js', import.meta.url)) works.
Almost all bundlers need to pass a URL to the Worker constructor ...
1
vote
0
answers
44
views
Uncaught TypeError: (intermediate value)(...) is not a constructor
I'm using the web worker package webworkify-webpack. I followed the instructions provided to implement it in my code. The code works perfectly fine in my local development environment, but when I ...
0
votes
1
answer
44
views
how to limit requests made by webworker in angular
Currently, in my Angular project, we upload batches of files using the webworker. It turns out that the webworker can make up to six requests at a time (depending on the browser, from what I've read ...
0
votes
0
answers
83
views
Web Worker Thread Pool
I have developed a Javascript Excel Add-in that uses a Web Worker to make background / long-running service API requests. The user determines how many requests need to be made, and the results are ...
0
votes
0
answers
192
views
RangeError: Array buffer allocation failed after multiple page refreshes despite sufficient memory
I'm encountering a RangeError: Array buffer allocation failed error in my JavaScript application after refreshing the page multiple times. The error occurs even though the memory usage appears to be ...
0
votes
0
answers
19
views
Create service which instantiates a web-worker and starts an interval so that main thread can subscribe to it?
At my job I encountered a problem where a component needed to poll for some data, and as part of that process update the title of the page based on information returned from said data. We noticed that ...
0
votes
0
answers
139
views
I'm having Issues Integrating Partytown with WordPress for Google Tag Manager Optimization
I'm trying to optimize my WordPress site's performance by offloading Google Tag Manager (GTM) scripts using Partytown. I've installed Partytown via npm and set up the necessary configuration, but I'm ...
0
votes
0
answers
41
views
web worker not responding instantly
I have a next js project and in that i have this fn that i run on, onKeyDownCapture
NOTE- the Fn works fine when its being executed on the main thread in the same file but when i move it to the web ...
0
votes
0
answers
47
views
Canvas fails to transfer ImageBitmap from Web Worker
In my HTML5/TypeScript game project I am trying to render chunks for a 2D world in a Web Worker into an OffscreenCanvas. As that rendering can take several seconds to complete (on lower-end devices ...
0
votes
0
answers
133
views
Web Workers with Angular 17 works in development mode but not in production build
I'm coding an Angular 17 app and I need to use Web Workers. The problem is that this is working in my development environment but not in my production build.
I do something like this:
// in a random ...
1
vote
1
answer
40
views
Use XHR in Webworker without CORS headers or preflight answer from server
I am working on a page that will be server by a small embedded webserver that I have no control of. On the page, some data transfer (XHR) should be done inside a web worker. The server will not send ...
-1
votes
1
answer
107k
views
Firefox Security Error: Content at http://localhost:NNNN/ may not load data from blob:http://localhost:NNNN/... when assigning blob url of MediaSource
I currently have a setup to emulate Web Workers support when some functionalities are not supported on different browsers in order to use the same messaging system across all browsers. In this case ...
0
votes
0
answers
72
views
How to open selected WebSerialAPI's SerialPort from Web Worker?
I want to delegate opening serial port and reading from serial stream to web worker, due to high throughput of serial port data lagging main thread.
First, user requests particular serial port
(I have ...
-1
votes
2
answers
53
views
What could make it so that one part of my function called by a Web Worker is calculated while the rest is not without any errors?
My Question/ Expectation is to find a possible point or statment that could cause such problems. If you have experienced something similar in JS, where it does go through the whole Function but only ...
1
vote
0
answers
58
views
Mounting a video transformer on a worker thread
I'm using @mediapipe/tasks-vision to segment video frames, do stuff, and then enqueue stream chunks using a video transformer. The magic happens in the transform function (see the specs here: https://...
0
votes
1
answer
245
views
WASM module not loaded inside web worker
I'm failing to load a simple WASM function, which sums two numbers, inside my web worker.
I tried it inside my main/index script which is working fine. However, moving the code into the web worker ...
0
votes
1
answer
60
views
How I can load my library function in my custom service worker?
I am making a custom library (file src/mylib.js):
export function myfunc(){
// do stuff here
}
Where I use rollup to build it as umd module:
import resolve from '@rollup/plugin-node-resolve';
...
0
votes
0
answers
58
views
How to imply the logic of getting a shared canvas in the case of offscreenCanvas rendering?
I have an offscreenCanvas rendering logic like in this OpenLayerrs example:
https://openlayers.org/en/latest/examples/offscreen-canvas.html.
In this example, we use a simple Layer class instance and ...
0
votes
0
answers
48
views
Javascript Web Worker execution pauses after some time when the browser does not have the focus
I am trying to send regular heartbeats from the frontend in a javascript web worker (using Angular 15.2) but I noticed that its execution stops after some time, when the focus is not anymore on the ...