-
Notifications
You must be signed in to change notification settings - Fork 1.2k
callbackify or promise-nodeify #2506
Comments
New method: ```javascript Promise<Array<{ name, description }>> ipfs.config.profiles.list() ``` BREAKING CHANGE: ```javascript Promise<{oldCfg, newCfg}> ipfs.config.profile(name, opts) // is now Promise<{old, new}> ipfs.config.profiles.apply(name, opts) ``` Possibly contentious; Adds `callbackify` as a dependency, see ipfs/js-ipfs#2506 for discussion.
I believed that the goal with #1670 is to stop having a callbacks version of the API all together. We can then have an example that shows how to use one of those modules for users that still want callbacks, but we won't support duo API |
+1 that, can't wait to get there, this is more about what to do in the interim. |
Land #1670 🤯 🎊 😅 |
mainly because we already started using it in other places, the boilerplate in most places was there already and i personally like it more because it forces us to be explicit about what happens. With having said that i think we shouldn't spend time on this, hopefully it will not cause problems and we should focus on removing the callbacks all together. |
+1, they are both small and will only be in the bundle temporarily until #1670 lands. Lets close this and not tempt others to join in on the bikeshedding! |
In #2390 I reached for
callbackify
when converting the internals to promises (only partially because the name has a nice symmetry withpromisify
), but missed that we already hadpromise-nodeify
in the codebase.It seems silly to have both when they do similar things. Ordinarily I'd just swap out
callbackify
but I'm not a great fan of howpromise-nodeify
makes you add boilerplate to handle setting up the promise yourself (I think, I could be using it wrong) and prefer howcallbackify
lets you write anasync
function and forget callbacks are even a thing.The caveat is that your
callbackified
function must return a promise - if you return a value instead everything explodes which leads to a few functions markedasync
superfluously, but I don't think this is a big deal as we've sort of agreed to mark promise returning functionsasync
even if they just chain through to a different function that actually does some async work.Given:
callbackify
promise-nodeify
@hugomrdias you started to have an objection to
callbackify
in the review of #2390 - could you explain a bit here?The text was updated successfully, but these errors were encountered: