Questions tagged [promise]
Promises are a tactic for deferred computing, suitable for several styles of concurrency: thread and event loop concurrency for local computation, and both synchronous and asynchronous remote messaging. A promise represents the eventual result of an asynchronous operation. The primary way of working with promises is through a method which registers transformations from the promise's eventual value or failure reason to a new promise.
promise
22,702
questions
0
votes
0
answers
10
views
Create a dynamic react component using portal and promise
Call a modal or drawer from anywhere in my react app using simple a function.
I have made this work by using the root.render, but the problem with root.render they cannot found any of my previous ...
-3
votes
0
answers
36
views
Fetch Api Call - JavaScript [duplicate]
How to use sync and await during fetch call in Javascript.
I have a separate JS file like 'APIService.js' which used fetch api to external Url.
function APIService(){
this.getData = asyn function(...
0
votes
0
answers
54
views
Unclear about callback as a promise [closed]
My boss just mopped the floor with me for being overly verbose and complicated in creating asynchronous code. The point of the code is to create a chain of sequential promises where one promise ...
3
votes
1
answer
58
views
How to elegantly manage AbortSignal event listeners when implementing abortable APIs?
Consider this simple example, probably a function you wrote a couple of times, but now abortable:
/**
*
* @param {number} delay
* @param {AbortSignal} [abortSignal]
* @returns {Promise<void&...
-1
votes
0
answers
68
views
Promise.All() executing but resolving Promises immediately without waiting for responses
I am trying to execute some tasks in parallel (literally, spread over multiple threads and CPU cores) via firing them off using Promise.All(), which then calls a function that sets them off to work ...
0
votes
2
answers
128
views
React Component - wait for prior promise method (fetch) to reach its finally {} block (cancelled using AbortController) before starting a new promise
I have a React component with 3 buttons representing 3 choices the user can make.
If the user clicks a button and then another button I cancel the previous HTTP request using AbortController.signal....
0
votes
1
answer
73
views
Promises and setTimeout priority [closed]
I had been struggling with the doubt , since in the event loop job queue has more priority than callback queue i.e, promises have more priority than setTimeout, then what about :
new Promise(resolve =...
0
votes
4
answers
81
views
What functions are passed to the Promise when awaiting in javascript?
Consider the following code, which awaits a Promise:
async function handleSubmit() {
try {
await submitForm(answer);
} catch (err) {
console.log('Error')
}
}
function ...
0
votes
3
answers
56
views
Async and Multiple Awaits | Call Stack suspension
I am working with the promises and async function. The thing I got to know that inside the async function if there is a await out JS engine will suspend the ongoing call stack's function calls and ...
0
votes
1
answer
26
views
What's called exactly when a promise executor calls the resolve function before you attach a resolve function with 'then'?
I swear nothing in this language makes sense. The promise executor is run immediately, and in this case it calls the resolve function, except a resolve handler hasn't been attached yet:
// FLOW STARTS ...
0
votes
0
answers
45
views
Cannot find global type 'Promise'
I tried to import functions in index.ts.
My codes
const functions = await import("./avs-directory/index").then(
(m) => {
return m;
}
);
I got errors like
tsc -p tsconfig....
0
votes
1
answer
74
views
Chrome Extension detection tab fully loaded
I'm creating a Chrome extension, part of its function is to click a link of a website and the site itself will open a new tab, then my extension will print the tab. I'm now facing a problem in ...
0
votes
1
answer
57
views
Why Angular httpclient use observers and not promises?
I've been looking in angular documentation, why httpClient use observers, but I didn't find a good answer.
My question is because I am working on a large project and we are looking for the most ...
0
votes
0
answers
39
views
Angular - show image in html over promise
In my Angular application I use this code:
<table style="margin-left:20px;">
<tr *ngFor="let user of users">
<td>
<img ...
-3
votes
0
answers
80
views
Does this specific pattern synchronize the specified awaited asynchronous calls? [duplicate]
Does this specific pattern synchronize the specified part of this function? Synchronization can be implemented variously; however, I would like to know if this specific pattern accomplishes ...