5,292
questions
0
votes
1
answer
51
views
Node JS / Javascript: Promise, uncaught exception not being handled by 'reject'
I set up the following to handle queries to a SQLite database. When there are no errors with the query, it performs as expected and all rows are logged to the console.
When I test the functionality ...
0
votes
1
answer
54
views
Angular async - how to get the string of an async method
I use this service class in order to get the network status:
@Injectable()
export class NetworkConnectionService {
constructor() {
}
addNetworkConnectionListener() {
Network.addListener('...
-1
votes
0
answers
38
views
Eslint to throw an error when promise is being assigned to a variable [duplicate]
I've had so many cases where what I mean to do was const a = await b() but I forget to add await and spending more than I should to figure out why the response body is empty. I'm wondering if there is ...
1
vote
3
answers
95
views
Loader not remaining visible during execution of a long-running task in JavaScript
I’m trying to show a loading indicator when executing a long-running task. The loader should remain visible for the entire duration of the task and then be hidden when the task completes. However, the ...
2
votes
1
answer
95
views
How can I avoid recursion in this JavaScript function that uses Promises?
I have a JavaScript function that generates an endless slideshow. The code works, but I'm concerned about each iteration ending in a recursive call to itself. Using developer tools, it appears that ...
-1
votes
1
answer
49
views
Promise.race not resolving in useEffect function for React Native mobile app
I am setting up a progressive Image loader (download and replacing an image with the same image in increasing quality). First I am making a cache check to see if the image is already cached. However, ...
0
votes
1
answer
64
views
Promises execution order in Microtask Queue
const p1 = new Promise((_, reject) => {
reject(1);
}).then((r)=>console.log(r)).catch((r)=>console.log(r));
const p2 = new Promise((resolve, _) => {
resolve(10);
}).then((r)=>...
0
votes
1
answer
53
views
Javascript ; loading data from url into object variable before running remaining code
I'm struggling to wrap my head around the javascript async/sync concepts.
I've subclassed an openlayers Layer class for some custom rendering in a map. After instantiating an object of the class, I ...
0
votes
0
answers
28
views
Promise.finally breaking Promise.catch depending on how I assign it [duplicate]
I admit I'm not a JavaScript promises expert, but this is bizarre. I'm creating an API service that's basically an Axios promise factory and importing it into Vue2 components.
The simplified example ...
1
vote
1
answer
87
views
Does Promise.resolve(1); involve microtask queue?
I am searching whether Promise.resolve(1); includes any mcirotask queue or not? There is no .then() or .catch() handler attached to it. Only Promise.resolve(1); Example:
const v = Promise.resolve(1);
...
0
votes
2
answers
63
views
Understanding Promise Chaining Internal Mechanics
I am learning promise chaining and I stumbled upon a doubt. Consider the below promise chain -
const myPromise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("...
0
votes
1
answer
43
views
ECMA proof for statement that in javascript promise handlers(then, catch) are enqueued in microtask queue after promise get resolved or rejected
I was searching the proof of statement that in javascript promise handlers(then, catch) are enqueued in microtask queue after promise get resolved or rejected.
First is above statement true that ...
-1
votes
1
answer
61
views
Can clearTimeout prevent the execution of a callback which has already been moved to the callback queue?
Consider a scenario where I have two tasks -
Task 1 is a callback which is set to be executed after 1 sec using setTimeout.
Task 2 is a synchronous/blocking task which takes comparatively more time ...
2
votes
1
answer
34
views
Empty result using FileReader and promise
I am struggling a bit with asynchronous operations and Promises (a quite new concept to me) using FileReader. I have found a very interesting thread about it there, but can't make my script to work ...
0
votes
0
answers
18
views
promise never exist pending state
I have hosted my backend on Render. When I try to reach the /login endpoint via https://hotel-website-1-9mlw.onrender.com/api/login, the promise remains in a pending state.
routes
import { Router } ...