Skip to content

Support promise#90

Draft
h2jorm wants to merge 6 commits intoalexguan:masterfrom
h2jorm:feature/promisify
Draft

Support promise#90
h2jorm wants to merge 6 commits intoalexguan:masterfrom
h2jorm:feature/promisify

Conversation

@h2jorm
Copy link
Copy Markdown

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant