notifme / notifme-sdk

A Node.js library to send all kinds of transactional notifications.

Home Page:https://notifme.github.io/www/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

send() should return a Promise

ibc opened this issue · comments

callbacks and errbacks are not nice, they happen out of context making it difficult to react differently on each send request.

IMHO rather than a global callback/errback, the send() method should return a Promise that resolves with the result of rejects with an Error (or custom Error child depending the failure).

Yes, send does return a promise with the result if you don't use a queue system.

See https://github.com/notifme/notifme-sdk/blob/master/src/sender.js#L34 (handleRequest is async)

Oh cool. May be the documentation/README should say that?

Yes sure, I'm updating the doc right now ;)
Thanks for the feedback.