Bluebird instead of Co in Coa?

Bluebird seems to override Co in a generator / coroutine related function. Bluebird supports exceptional high-speed performance, so for the sake of discussion (assuming the above overlap assumption is correct) if you need to replace Bluebird for Co with Koa (Node.js context), would it be easy to do without reducing the functionality of Koa, and if so , how?

(I think this is impossible to do, since it seems that Koa is built on top of Co and does not explicitly reveal it, but makes it a facade. Such a replacement seems to be equivalent to replacing jQuery with something else in Bootstrap)

+4
source share
2 answers

, bluebird co . Bluebird.coroutine vs co (short for coroutine).

Bluebird.coroutine co , co . Bluebird.coroutine , , , , thunks callbacks.

Async , , . , .

Bluebird.coroutine bluebird.

, . , , concurrency, , + - , , , thunks/callbacks/minimum promises.


co , co, Bluebird.coroutine:

var co = require("bluebird").coroutine;
// Configure all yield types you need using co.addYieldHandler
// See documentation for examples
module.exports = co;

, - , . koa (, koa ?: D), bluebird.

+8

esailija Bluebird,

, , .., , . Bluebird . koa . . https://github.com/petkaantonov/bluebird/issues/131#issuecomment-36975495

, . , , Co - . Co.js , Bluebird.js . ES6, Bluebird Co.

-5

Source: https://habr.com/ru/post/1536750/


All Articles