New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternate Promise libraries #425
Comments
I went into the However when I looked at how you used it in Honestly I'd say that it's still worth it to provide it, to make the unknown portion of the 1.1 million odd daily downloaders of |
I'd like to voice support for this feature. I'm delighted to see universal promise / callback functionality added out of the box (thanks!), but I've got bluebird integrated across my libraries and it would be great to have that functionality available in filesystem calls without an additional layer of wrapping. |
+1 to this, particularly because having bluebird |
@jprichardson @manidlou Thoughts? |
If we can do a simple |
Yeah, I don't get it either. Someone care to explain? |
I am wondering too. Is there any specific reasons that users don't want to do this?! |
@jprichardson @RyanZim @manidlou At least i had issues with it, open for correction. |
@rijnhard That isn't necessary; just set |
@RyanZim Welllllllllll then theres no reason. Assuming using es6 imports it's still possible then its just ignorance on my part. |
@rijnhard With ES6 imports, you'd do: import bluebird from 'blubird'
global.Promise = bluebird |
I find it ironic that i didn't know this, even though it's pretty obvious. I see no reason to provide a I have some refactoring to do. |
I recently stopped overriding the global More importantly, messing with (Edit: I should have gone to sleep last night and built that this morning. It's now failing for the right reasons.) |
Maybe any-promise is a solution here? It defaults to the native Promise, so nothing changes for users who don do anything. Imo it's great to have a single place to set the promise implementation for a bunch of libraries, without touching the global state. |
In regards to RyanZim/universalify#5: Frankly, I don't get the point. How is overriding the promise implementation used by universalify and anything else that depends on it more "evil" than overriding If you're a library, yes, overriding If you're an app, what's the harm of overriding |
You're not overriding |
@thecjharries Erm, yes, you are. CommonJS modules are singletons. Anything that imports |
@RyanZim Huh, I apologize. I'll modify that pull request when I get off this evening to use a factory. With a factory, my argument still applies. Again, sorry. I should have remembered that. |
I've been thinking about this all afternoon, and I don't see any good way to do it without a
|
Bluebird offers you long stack traces. In my lib I use special instance of bluebird (it is not singleton, you can have any version of bluebird with any config). That's why I use my own wrapper fs-extra-p and Promise support in the fs-extra is not useful for me (and even more — should be not used to ensure that stack traces will be clear). |
Going to close this out as I've yet to hear a good argument for not just overriding |
Let me give it a try:
That is a believe I share. The case I have is a private npm module, which I'd consider as a library in this sense, so I don't want to overwrite In order to use bluebird with fs-extra, we currently have to either wrap the fs-extra call in a promise chain like For a while we did the |
I've understood my requirements a little better now: I (as a library) definitely don't want to change the behaviour of fs-extra for everyone, so I need to make sure that if I want to use bluebird, such a promise setting affects only me. The way I'm now handling the bluebirdification of fs-extra is during the require phase: const fse = require('ensure-bluebird')(require('fs-extra')) The |
As per #403 & overlookmotel/fs-extra-promise#27, people are asking to use custom (non-native) promise implementations.
I don't know if this is a use-case we should support or not.
The text was updated successfully, but these errors were encountered: