Skip to content

Conversation

@vincentgor
Copy link

@vincentgor vincentgor commented Sep 22, 2016

if we don't like to use native Promise, we can choose other Promises, such as bluebird.

co.set(require('bluebird'));
co(1).tap(console.log);

by using it ,we can use the tap function of Promise


update on 2017/2/21

co.promise = require('bluebird');
co(1).tap(console.log);

@jakwuh
Copy link

jakwuh commented Sep 29, 2016

Are the any solid reasons of using generators along with non-native Promises?

@jeanbaptiste-brasselet
Copy link

Personnaly I would like to have this option. And about the why :

  • performance (native promise are slow)
  • avoid the pattern bluebird.resolve(co.wrap(...)) if you need some helper from bluebird for example

And I can't see any reason why not ?

@jakwuh
Copy link

jakwuh commented Oct 14, 2016

@jeanbaptiste-brasselet-planorama yes, this absolutely makes sense.

@vincentgor
Copy link
Author

@jeanbaptiste-brasselet-planorama I agree with you. But I just consider the second point.
As I said above, if I want to use some functions with bluebird, such as co(1).tap(console.log);, I hava to use bluebird.resolve(co.(...)). It is a fact that your ability to express a lot better than I do.

@axetroy
Copy link

axetroy commented Dec 1, 2016

yeah
it should be

@deepal
Copy link

deepal commented Jun 20, 2017

Of course this is a valuable feature! +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants