mariocasciaro / scatter

IoC container and out-of-the-box extensibility for Node.js applications
MIT License
154 stars 14 forks source link

How to deal with the asynchronous service #30

Closed zhangpp520 closed 9 years ago

zhangpp520 commented 9 years ago

Scatter can make the service become a dependency is so powerful,but if an injected service is an asynchronous method and need an callback argument,how deal with that?

mariocasciaro commented 9 years ago

You can just return a promise from your service. You can use any Promises/A+ implementation like https://github.com/petkaantonov/bluebird or https://github.com/cujojs/when

zhangpp520 commented 9 years ago

Thank you so much.I think maybe you can mention that in the doc.