hi,
I guess it's a common question, but can't get it working
I would like to use asyncblock [1] to handle method processing
I have the following in my code:
var work = new Model({..})
...
work.events
Actually, Model.prototype.initialize creates the events attribute. Thus I
should defer the call for work.events until initialize finishes running.
My initialize method without asyncblock is at http://pastebin.com/svaVvy7X
The problematic parts are when we call nestwith.find and nestwith.findOne.
Both of them accept either a backbone like {success: .., error: ..}
"callback", or a real callback function: callback(err, result).
As you can see I'm using backbone on the server side, and would like to
extend it to support embedded documents. All this for MongoDB for the
moment.
I've tried asyncblock either using flow.add('nested') and
collection.find(args) = flow.wait('nested'), or using the x.sync approach
with enableTransform. Neither of them worked as my callback never get
executed, more interestingly, asyncblock does not wait for it to get
executed.
For x.sync I get "TypeError: Cannot call method 'sync' of undefined".
any ideas or recommendations?
[1]: https://github.com/scriby/asyncblock/blob/master/docs/overview.md
--
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