Skip to main content

Questions tagged [promise]

"Promises" are a particular 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.

4 votes
1 answer
104 views

I am interested in creating a class that manages a thread and executes SQL queries sequentially within it. The queries would be submitted from various parts of the program, and the results would be ...
QuitLN's user avatar
  • 43
1 vote
1 answer
107 views

I have created Axios wrapper following SOLID principles. Is there any feedback on improving it's structure in a more cleaner and better way? axiosconfig.ts ...
C Sharp Guy's user avatar
6 votes
2 answers
287 views

I use the following snippet with my browser homepage to detect whether or not I have my VPN connection turned on. If the IP timezone is different from the browser timezone, then it is most likely the ...
jsx97's user avatar
  • 207
4 votes
2 answers
429 views

I have attempted to implement the native Promise object provided by the browser in JavaScript. The code is pretty easy to understand. It supports most of the promise functionalities, such as chaining, ...
Napoleon Bonaparte's user avatar
0 votes
1 answer
117 views

I was suggested by @Bergi on StackOverflow that Async Promise constructors are any pattern. The argument behind this is that async Promise swallows the errors. In my case, I have try..catch so I'm not ...
jcubic's user avatar
  • 248
4 votes
2 answers
160 views

I wrote an idempotent script loader (for the browser), where the same script won't be loaded more than once. scriptLoader.js: ...
lonix's user avatar
  • 153
2 votes
1 answer
137 views

I am building a basic authentication system with a node backend and wonder whether I am using the try-catch block excessively. I have this example controller: ...
user8758206's user avatar
2 votes
0 answers
315 views

I've been using the excellent pg-promise library for a few years now, but my primary irk with it is that the stack traces are sometimes unhelpful. For example, the following test will fail (currently ...
BrDaHa's user avatar
  • 133
1 vote
1 answer
453 views

I have built a basic app which uses firebase for authentication. The app is pretty simple. Sign up the user to firebase using email and password. Sign in the user Sign out the user Also, I have ...
DeveloperLV's user avatar
1 vote
1 answer
103 views

The scenario here is to get a filename from the console and create it if it does not exist. I have two main questions; Is the way I used promises the best way? is there a better way? Here is my code;...
Safnas's user avatar
  • 59
2 votes
1 answer
311 views

I'm new to using JS for anything other than DOM manipulation, so I'm not sure if the following code is taking full advantage of the Async concept in JS. This is an example of a function I'm writing in ...
RaVeN's user avatar
  • 23
2 votes
2 answers
111 views

This code is from my blog project. This project is almost done. This is working well. I can create new posts and update and display all saved posts. ...
Bhaskar's user avatar
  • 123
4 votes
1 answer
1k views

Imagine we have a function that returns a Promise, ie call a GET endpoint of an api and return the response data. ...
slepic's user avatar
  • 5,657
1 vote
2 answers
609 views

The ideas are When multiple async calls are made, to be able to start consuming from the first resolving one regardless in what order the promises are fired. To construct a modern emitter of async ...
Redu's user avatar
  • 946
2 votes
1 answer
49 views

I have a function that takes in a string and based on the string hits different APIs to fetch images. I have solved it by writing an interface and then as the return type of the function, it returns a ...
rakshith's user avatar

15 30 50 per page
1
2 3 4 5
17