On 21 paź 2013, at 19:52, Reza Razavipour reza.razavip...@gmail.com wrote:
we all of this I still can not figure out how to take an async function and
change it from callback to a promise.
Many libraries provide it's own utils for that, just check their documentation:
Let us use an example:
var q = require('q');
var myAsyncFunction = function(err, result) {
if (err)
console.log(We got an error);
console.log(Success);
};
myAsyncFunction().then(function () { console.log(promise is working);
});
var promisify = require('deferred').promisify;
var myAsyncFunctionPromiseVersion = promisify(myAsyncFunction);
myAsyncFunctionPromiseVersion().then(function () { console.log(it works!); });
On 21 paź 2013, at 21:57, Reza Razavipour reza.razavip...@gmail.com wrote:
Let us use an example:
wonderful... thank you.
and in q, what would that look like?
Regards,
Reza
On Mon, Oct 21, 2013 at 1:09 PM, Mariusz Nowak mari...@medikoo.com wrote:
var promisify = require('deferred').promisify;
var myAsyncFunctionPromiseVersion = promisify(myAsyncFunction);
Hi Reza,
I was just trying to wrap my head around how promises work yesterday and I
highly recommend this article:
http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/
I'm pretty new to node.js as well and found the explanation here very easy to
understand.
Also, I would take a
I am a fairly new to javaScript and node.js both.
I am trying to wrap my head around promises and I am having a hard time. I
am looking for a very simple tutorial/video on this topic and having little
success.
Is there a reference that can be recommended? A before and after code
snippet can
Try http://spion.github.io/promise-nuggets - its not complete yet but the
main concepts are covered
On Oct 19, 2013 12:11 AM, Reza Razavipour reza.razavip...@gmail.com
wrote:
I am a fairly new to javaScript and node.js both.
I am trying to wrap my head around promises and I am having a hard
I just found this link at es-discuss
http://flippinawesome.org/2013/10/14/a-simple-visual-model-for-promises/
On Fri, Oct 18, 2013 at 7:34 PM, Gorgi Kosev gorgi.ko...@gmail.com wrote:
Try http://spion.github.io/promise-nuggets - its not complete yet but the
main concepts are covered
On Oct