Questions tagged [async.js]

A module with functions for working asynchronously with JavaScript that can be used both in NodeJS and in the browser.

Async is a utility module which provides straight-forward, powerful functions for working with . Although originally designed for use with , it can also be used directly in the browser.

Resources

944 questions
-1
votes
1 answer

Object not modifying on async.each

I have the following code: async.each(strategies, function (strategy, callback) { filterEventTypes(strategy.eventType, function (err, res) { strategy.filters = []; var filter = {}; filter.eventTypeIds = res; …
Ricardo
  • 9
  • 2
-1
votes
1 answer

nodejs async library and redis

After a long time of "no.. I don'*t want to do this.." I finally need to use the async.js library. I have no glue how to use it in a way it will make me happy... Let's consider this pseudo function which is very simplified: Seriosly.. I don't even…
user2429266
  • 360
  • 2
  • 18
-2
votes
1 answer

Parent function is not waiting for child to finish

Inside getMetadata(), Object.keys function is not waiting for httprequest to finish. How can I make object.keys function to wait till httprequest function manipluates the result variable? I'm using node. I tried to make promise but failed. function…
-2
votes
1 answer

Async Await doesn't work

So I have the following functions in Javascript which help me set my projectDetailsList state by querying a server for the list of projects and their details: getProjectDetailsListHelper(){ return new Promise(async (resolve) => { await…
-2
votes
2 answers

Node.js async taking too long to execute

I've got my array of queries var array = [ 'UPDATE EVALUATION SET mark = "16" WHERE id_eval = "21" AND id_usr = "125"', 'UPDATE EVALUATION SET mark = "9" WHERE id_eval = "22" AND id_usr = "125"', 'UPDATE EVALUATION SET…
Evgeny
  • 97
  • 2
  • 15
-2
votes
2 answers

NodeJS Async: callback allready called?

I am getting this error: node:19100) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Callback was already called. On my async.each call, it seems like it is trying to call "done()" more then once per…
Rémi
  • 1,313
  • 3
  • 20
  • 41
-2
votes
1 answer

False routing in express.js

I am trying to use the following filter to divert packages but it fails: I've build to routes using express.js: app.get('/billdetails/:year/:month/:phoneId', function (req, res, next) { var db = req.db; var year = req.params.year; var…
icodeweb
  • 3
  • 1
-2
votes
1 answer

Nested async functions

With the following code, can I be sure that the last callback will return the updated variables? var a = 0; async.forEach(collectionarray, function(item, cb1) { async.forEach(collection.anotherarray, function(item, cb2) { a +=…
joe.js
  • 221
  • 2
  • 10
-2
votes
2 answers

why it is possible to pass the undeclared function to setTimeout

Here is the code example from Trevor Burnham's "Async JavaScript" book (The Pragmatic Bookshelf, 2012): var async = require ('async'); var start = new Date; async.series([ function(callback) { setTimeout(callback, 100); }, function(callback) {…
Volodymyr
  • 1
  • 2
-2
votes
2 answers

Expressjs, async and middleware does not work properly

I'm doing tests with the framework expressjs in which I am creating a middleware that runs before the blocks of routes, but it does not work correctly. I thought it could be my code that escapes the asynchronism and it does not run correctly, but I…
Anto
  • 203
  • 1
  • 3
  • 12
-3
votes
2 answers

Use setTimeout inside another setTimeout function in javascript

I'm having this code :- var i = 3 var p = Promise.resolve(i) while (i > 0) { (i => { p = p.then(() => { return new Promise(function (resolve, reject) { console.log('start', i) …
Ketan Bodarya
  • 21
  • 1
  • 6
-3
votes
2 answers

Nodejs best way for synchronous execution?

What is the best way for synchronous execution when working with external modules? I would like the output to result in: Setp 1: Hello Setp 2: Hej Step 3: Hola Step 4: Bonjour Example: //File: main.js var greetings =…
-3
votes
1 answer

Doing something right after a for loop

As you know, NodeJS is asynchronous. But it's a bit disapointing. For example, as long as i understood, a condition will be synchronous while loop will be asynchronous. My question is how to wait a for loop end ? I've heard about async.js but i…
Little squirrel
  • 29
  • 2
  • 11
-5
votes
2 answers

getting async nodejs value from each callback calls

var async = require('async'); var square = function (id, callback) { Business.prototype.getBusinessUser(id,function(userObject){ return callback(userObject); }); }; async.eachSeries(findBusinessResult, function (businessObject, callback)…
Daniel Adenew
  • 6,825
  • 6
  • 48
  • 70
1 2 3
62
63