It's exactly that kind of thing streamlinejs does, isn't it?

On Saturday, June 22, 2013 12:39:23 AM UTC+4, Chaoran Yang wrote:
>
> Dear all,
>
> I'm tired of the poor syntax of Step or Async or any other existing flow 
> control libraries. I created a new flow control library in nodejs: 
> Serialize (http://github.com/chaoran/node-serialize).
>
> Here's a brief introduction. There's more in the Github page.
>
> Serialize
>
> A simple node utility to serialize execution of asynchronous functions.
>
> <https://github.com/chaoran/node-serialize/blob/master/README.md#what-does-it-do>What
>  
> does it do?
>
> Asynchrony in nodejs is great, except that it makes your code looks 
> horrible because of all the callbacks. If you use synchronous functions, 
> which give you good-looking, easy-to-read code, they will block the thread 
> and make your server not responsive.
>
> Here's serailize to the rescue! serialize converts your asynchronous 
> functions into serialized versions. Serialized functions are executed one 
> after another, without explicitly chaining them with callback functions.
> serialize does *NOT* execute the function synchronously (block the 
> thread), it just serialize the execution of asynchronous functions. So that 
> it makes the code looks synchronous, but it is actually ascynhronous 
> underneath.
>
> <https://github.com/chaoran/node-serialize/blob/master/README.md#how-to-use-it>How
>  
> to use it?
>
> To create a serialized version of an asynchronous function, call serialize 
> with 
> it. For example, if you want to make serialized versions of fs.writeFile
>  and fs.mkdir, you do:
>
> var serialize = require('serialize');
> fs.mkdir = serialize(fs.mkdir);fs.writeFile = serialize(fs.writeFile);
>
> Then, you can use fs.mkdir and fs.writeFile like they are synchronous 
> functions:
>
> fs.mkdir('new');fs.mkdir('new/folder');fs.writeFile('new/folder/hello.txt', 
> "hello world", callback);
>
> These function will be executed one after another, but they will not block 
> the thread as their synchronous versions do. The callback will be invoked 
> after the last call completes.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to