Skip to content
Advertisement

Tag: asynchronous

Questions on performance regarding async/await vs Promises and the event loop

Introduction A colleague of mine and I have been discussing the asynchronous nature of JavaScript in the browser and wondering what technical benefits are. We are aware that async/await is syntactical sugar for Promises, but curious to know if there is any other performance benefit for using one over the other. For example: Are both async/await and Promises treated the

wait for asynchronous functions to finish in Angular

So I was working on a new component in Angular and in the ngOninit I have the following asynchronous functions below… This.getUserProfile needs to be finished before I can call this.getPrivateGroup() and this.getPrivateGroup() needs to be finished before I can call this.loadGroupPosts(). I know I could write these functions inside the callback of the asynchronous requests, but I was wondering

How to execute multiple mongoose queries asynchronously and wait until all of them finish executing before sending response?

Thanks in advance, but could someone explain to me how can I execute a different query for each property of my request? I am trying to create a search sidebar menu, when user changes checkbox values I create an object with these properties: I want to push a query into an array of functions and then execute them using async.parallel

Promises returned data ”

my data which is fetched from youtube is using nodejs is – Now I want to search 5 related videos to each video my api and api to 5 related Videos is given below It is giving the output like How to solve this pending problem or how to wait so it gets full data. Answer It happens because you

Implementation of Promise.race()

I came across an implementation of the Promise.race() method in JavaScript, which works as expected, but doesn’t make much sense to me. How does the forEach loop end up assigning a specific promise’s functions? Answer By definition a promise resolves / rejects only once, no matter how often you call resolve or reject. Therefore the promise you construct will resolve

how to chain async methods

The API I’ve written has several async methods that do not return a value, but still should be executed in the order they are called. I’d like to abstract the awaiting resolution from the end user so that they can chain method calls and expect that each promise is executed after the previous is resolved like so: It is not

Async Concurrent Queue with max concurrency

I’m running across a bug with a custom asynchronous queue that calls 10 async functions at a time. I’m initiating the queue with 50 jobs, once first 10 jobs are finished the queue moves to the subsequent 10 until it finishes all. The bug I’m coming across is that once it finishes 50, it restarts with first 5 jobs with

Advertisement