4 ms·
Hi, thanks for the questions, sorry for the late reply.. httpinvoke fully implements Promises/A+ specification. The spec is very short and easily implementable
by tahu 13y ago
Hi, thanks for the questions, sorry for the late reply..
httpinvoke fully implements Promises/A+ specification. The spec is very short and easily implementable. The implementation in httpinvoke takes only 568bytes when minified (check it out!).
So the answer is, if you use httpinvoke with a different promise library, it will work, unless the library really is at odds with Promises/A+ specification. Which is unlikely, because all the major promises libraries support it, even if they do not indicate that in their documentation.
httpinvoke only contact with the external promise (which it can only get when onFulfill or onReject returns one) is the .then method here [1].
[1] https://github.com/jakutis/httpinvoke/blob/master/src/common/closures.js#L55 https://github.com/jakutis/httpinvoke/blob/master/src/common...
- antihero 13y agoSay, hypothetically (I haven't done any tests or anything) that Bluebird was faster than the included promise specification, is there some sort of dependency injection to replace it, seeing as it's a spec?
- tahu 13y agoWithout a doubt Bluebird, When.js, Q, then/promise and others are faster. The implementation in httpinvoke is optimized for code size. The other reason for current solution is that the specification for creating and resolving promises [1] is not yet published. Having a Promise object in global scope, as exported by Q, Bluebird and then/promise, is not enough. There is no uniform way to hack into these implementations and use their promises resolver. But when resolvers-spec is available, httpinvoke will definitely check for already loaded promises library and reuse it. [1] https://github.com/promises-aplus/resolvers-spec https://github.com/promises-aplus/resolvers-spec