Closed catalint closed 8 years ago
I'll change the tests a bit to better handle promises, will need to upgrade to lab 10 (it's 8 right now in package.json)
No chance I will be removing callbacks. I am open to offering a secondary promises support same way I did in hapi. That is, callback is the default and how the system is designed while promises support is added as syntactic sugar.
Note that I am not anti-promises or am passing judgement on people who likes to use them. It's a perfectly valid design choice. It's just not my design choice.
We can have both worlds!
Expect this PR to be updated in a couple of days.
updated to support both promises & callbacks, no change in logic was done to callbacks , callback tests ran without any changes
added tests for promises , added promise sections in README.MD after the callback ones
Maybe it's time we re-discuss putting https://github.com/hapijs/hapi/blob/master/lib/promises.js into hoek.
@Marsup someone should just do it and PR the move on hapi.
hi @hueniverse have you gotten the chance to look over this? if you require any changes I'm more than happy to do them. thanks!
I'd like to see the pattern used by hapi moved to hoek and then used here. Also, do we really need to c/p the entire readme?
As I said back in April, the only way I am going to support promises is using the same pattern I used in hapi. This would require moving that utility to hoek. I might look into that but it's low on my list.
Can this be reconsidered now that https://github.com/hapijs/hoek/issues/176 met a dead end?
This might also help with: https://github.com/hapijs/hapi/issues/3150
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
An attempt at removing callbacks and relying on promises.
No major refactoring was needed for tests, just removing callbacks & relying on promise chain
notable changes for client
none
notable changes for policy
domain
is deprecated, my best guess is that using promises doesn't need the use case callback needed when bindingpolicy.get(key)
)resolve()
reject(err)
policy.get(key,{full:true})
todos
what are your thoughts on this?