Sort of. But different. streamlinejs will transform your synchronous call and rewrite your source code into asynchronous calls. You need to run it with streamline's "_node", not the simple "node". I guess most people won't use that, unless they really really need to use streamline.
Serialize is a very small flow control library, purely javascript, nothing magic. It's not as full fledged as streamlinejs. But I believe it's powerful enough to help with most cases where people need a flow control utility. And you can serialize any asynchronous call in a program, and the program is still correct. Anyway, I don't like to use "_node" to run an "node" app, and I don't like the underscore thing in streamline.js. It's just a personal taste. That's why I wrote "serialize": write the code exactly the way I want it to be, and using the most nonintrusive way. -Chaoran On Jun 22, 2013, at 12:50 AM, Alex Kocharin <[email protected]> wrote: > > 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. > > 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. > > 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 a topic in the Google > Groups "nodejs" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/nodejs/oH6XyOJNWwM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- 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.
