4,754 questions
0
votes
1
answer
120
views
After polling a server using setinterval, file will download but won't open in a new tab
I am polling a server, using setInterval, until the pdf's that I want to download are ready...Once the pdfs are ready to download, I clear the interval, and then I call a function
async function ...
2
votes
3
answers
104
views
Delaying 2 setIntervals using setTimeout doesn't work
I've been writing a userscript for a site and I want to show an update notification while the user is tabbed off of the site, and I came up with an idea to use the site title for that.
This is my ...
1
vote
1
answer
46
views
React Hooks and Events [duplicate]
var [testVar,setTestVar]=useState(0)
var showTestVar=()=>{
console.log(testVar)
}
var effectTest=()=>{
setTestVar(1)
setInterval(showTestVar,1000)
}
I want to have a ...
0
votes
0
answers
36
views
Tizen tv unintentionally goes to no internet screen
I am creating a tizen web app where I am checking the internet connection and the do a fetch request to check that the internet is working. but the issue is that it randomly tells me that no internet ...
3
votes
1
answer
66
views
Why does consoling prints the same value but state gets updated when used inside useEffect - React
In a video I saw creating a progress bar and updated its value using state and wrapped it inside setInterval for updating it every 15 millisecond and the whole being wrapped inside useEffect, with no ...
0
votes
0
answers
60
views
The most accurate way to do something at a constant rate in JS [duplicate]
I need to run a function every fixed time with maximum precision. For example, every 30 milliseconds a function will run. I tried this code:
this.interval = setInterval(() => {
this.foo(...
1
vote
1
answer
41
views
what triggers change detection when using OnPush and setInterval outside angular zone with markForCheck?
I couldn't really understand what is causing change detection to run in the below code. I understand that markForCheck doesn't do it but something must do it because the view is updated if you play it ...
2
votes
1
answer
64
views
Nodejs/Bun high resolution setInterval for <5ms
How to make a high-resolution setInterval in Node with
It's possible in browser with just setInterval
I want to make an real-time application for working with serial on 250Hz speed
For this I need to ...
1
vote
0
answers
74
views
writeFileSync fails when called inside of setInterval
This is really a head scratcher...
I'm running Node 22.9.0 on a raspberry PI (Linux raspberrypi 6.1.21-v8+)
My script, which is run as root, can write a new file in the current directory and update ...
2
votes
3
answers
78
views
question related to use setInterval and useEffect, what's the difference between pass function name and anonymous function?
Recently I am reading article related to useInterval, these code works fine:
import React, { useState, useEffect, useRef } from "react";
import ReactDOM from "react-dom";
function ...
5
votes
4
answers
166
views
Loop inside setInterval does not iterate over the second interation
I have a useTypewriter hook that seems to skip the second iteration since the i never logs as 1. Why is the code not working? The output should be howdy, not hwdy.
Here is the full code:
const { ...
0
votes
1
answer
51
views
clearInterval Doesn't Work if setInterval is Inside of a Loop
If I initialize setInterval inside of a loop within a function, clearInterval doesn't work. I tried setting it to the name of the variable and then the function itself. There are plenty of questions ...
2
votes
0
answers
38
views
Firefox - Javascript setInterval WAY WAY off [duplicate]
I'm trying to scroll text up the screen in about 4min +/- a few seconds doesn't even matter, along with a 4min audio.
To follow it, I've muted the audio 1 second every 10 seconds.
I display the ...
-4
votes
3
answers
68
views
Set Interval Js [duplicate]
I want to make a slide show with JS using the setInterval function, but I don't know why my code is not working? While there is no error in console, I have a number of pictures that start with the ...
2
votes
3
answers
57
views
How to use useState, Dispatch input?
Consider this code:
const [seconds, setSeconds] = useState<number>(START_VALUE);
useEffect(() => {
const intervalId = setInterval(() => {
setSeconds((previousSeconds) => ...