Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Implement an optional promise based interface #33

Open
sam3d opened this issue Oct 25, 2017 · 1 comment
Open

Implement an optional promise based interface #33

sam3d opened this issue Oct 25, 2017 · 1 comment

Comments

@sam3d
Copy link
Contributor

sam3d commented Oct 25, 2017

I don't know how possible this would be, because I can't remember if anything is returned after running something like serf.members(cb). it would be great to have the option of doing both of the following as if nothing is returned it wouldn't break the existing API (obviously this wouldn't work for the streams):

Standard

serf.members((err, members) => {
    console.log(members);
});

With promises method

serf.members()
.then(members => {
    console.log(members);
})
.catch(err => {
    throw err;
});

With await/async

let members = await serf.members();

Is this something that would relatively easy to implement or is it architecturally a bit of a pain?

@zbjornson
Copy link
Collaborator

Nothing is returned from the command methods except for the three streaming commands (stream, monitor and query). Looks pretty easy to do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants