Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support promise #90

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Support promise #90

wants to merge 6 commits into from

Conversation

h2jorm
Copy link

@h2jorm h2jorm commented Mar 14, 2019

This is a nice zookeeper library. However, compared to promise, the callback style is not coding friendly today. Some issues or pull requests are related to promise API. For example, #47 #58 #87 .

I have made the following methods promise supported.

  • Client.create
  • Client.remove
  • Client.exists
  • Client.getChildren
  • Client.getData
  • Client.setData
  • Client.getACL
  • Client.setACL
  • Client.mkdirp
  • Transaction.commit

Example

zookeeper.create('/a', Buffer.from('hello'))
    .then((path) => {
        assert(path === '/a');
    }, (err) => {
        console.log(err);
    });

This PR does not add new methods and backward compatible. In general, the methods above will return a promise if they fail to receive a callback function as the last parameter.

@h2jorm h2jorm force-pushed the feature/promisify branch from 118a523 to cc7dd15 Compare March 14, 2019 07:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant