carlessistare / grpc-promise

GRPC promisify module for all Request/Response types: standard and stream
MIT License
82 stars 17 forks source link

Accessing original callback function #5

Closed chidiwilliams closed 6 years ago

chidiwilliams commented 6 years ago

After promisifying all functions in the RPC, how do I access the original callback function, if I desire to use both promise and callback versions?

** Great library, by the way...

carlessistare commented 6 years ago

Thanks @chidiwilliams and sorry for the late response. Yes indeed once you promisify the client instance, you've got no access to the old callback functions, since the client itself is modified. By now you either create 2 clients in the same project (which is a bit dumb), or propose an update where we duplicate all service functions: one with promise, two with old callback functionality (suffixed by 'Old').

chidiwilliams commented 6 years ago

Thanks @carlessistare. I'll propose having duplicates of the service functions with a prefix or suffix.

carlessistare commented 6 years ago

Hi @chidiwilliams I am currently working on a PR for promisify one single function of the grpc service, for the use cases where promisifyAll is not necessary. I hope it would help, so you could have a function with callback and the other with promise. It'll be done in a couple of days and I'll resolve this issue then. Keep you posted

chidiwilliams commented 6 years ago

That'd be great!

carlessistare commented 6 years ago

@chidiwilliams PR https://github.com/carlessistare/grpc-promise/pull/7 fixes this issue