promise - A module providing promisify (denodeify) for AngularJS $q -
I would like to share the code to use Braureware among my node .js server and my enzyme client I want to keep the ADI callback based on the node.js side, but promise $ q in the ERRJS code.
Example:
// I am going to share this function / this file is something in foo.js' function foo (cb) {// Async works in cb (faucet, result); } Module.exports = foo; // In the AngularJS setup, I want // a promisified version of this function // a connery service app.service ('foo', $ q.promisify (as required ('foo.js')); // My controller looks at the normal AngularJS API app.controller ('FooCtrl', [foo], function (foo) {foo ()). (Function (result) {$ scope.data = result;}}}}])); "Full" wired libraries like Q or Blubber provide tools to replace callback-based tasks for people who promise - Q is in the denodeify Promise and promisifyAll in Bluebird. Is there any AngularJS module providing $ q.promisify or similar? Note I do not know how to write promisify , the greener version is only 16 lines of code. A customized version may be based on the implementation of Bluebird. For this reason I am asking the question to avoid changing the wheel again, so that I can make my time investing in adding more value to my time.
You can use bluebird or rsvp The function ("err, arg1, arg2, ...) for the thun ( thumb function for Code>). However, you should have a cover which also calls the $ range. $ Applied () when the promise is complete. < / Div>
Comments
Post a Comment