Tag Archives: nodejs

A Little Misconception about Promise (nodeJS)

Consider the following code var Promise = require(‘bluebird’); function f(x){ return Promise.try(function(){ console.log(“start ” + x); return Promise.delay(500); }) .then(function(){ console.log(“finish ” + x); }); } var promises = []; promises.push(f(1)); promises.push(f(2)); Promise.each(promises, function(){ return f; }); Expected result: start … Continue reading

Posted in Programming | Tagged , | 2 Comments

Parallel asynchronous functions with NodeJS promise

Long time since I last wrote a post. So recently I’ve been doing NodeJS and meets a cool feature: Promise. Promise is a way to make asynchronous callback look like serial, so instead of writing doSomething(function(err,obj){ if (err) … … … Continue reading

Posted in Programming | Tagged , , , , | Leave a comment