Closed jeron-diovis closed 10 years ago
async — because IO (filesystem).
it's very easy and idiomatic in node.js to write async code. Sorry, read-c won't become async - we don't want more complexity.
I just don't know how to return async result from module (without exporting functions)
There is no way.
Look at using node-fibers and making an adapter for sync behaviour.
Why not to to read components synchronously (or at least allow it as some option)? While provided functionality is so useful - sometimes it can't be used together with third-party tools. Brunch was designed to work with this reader asynchronously. Grunt gives us 'this.async()' inside task, and it helps. But what about something more specific? For example, I want to compose modules list for LMD builder. All I need is to specify module.exports field in config file - but there is no way to wait until filelist will be read.
So can this tool be upgraded to be synchronous? Or, maybe, I just don't know how to return async result from module (without exporting functions) - then, could you give me some advice about this?