Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support for ES6 Proxy style client calls #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zdychacek
Copy link

Hi,

this pull request extends the client with an ability of making calls using ES6 Proxy API.

It extends Client class with $ property which is an instance of the Proxy object. This object allows you to call methods directly in following style:

var promise = client.$.company.employees.getDetail(1, true);
// -> calls registered method on server (company.employees.getDetail) and returns Promise

This pull request also adds a new method Client#methodCallPromise() which is a Promise based wrapper around the Client#methodCall() method.

You can find an example of this feature in example/proxy_calls.js file and in Readme as well.

If you like this feature, you can merge it :)

@zdychacek
Copy link
Author

Oh yes. It won't work with older versions of node. Therefore failed build for node v0.8...

@patricklodder
Copy link
Collaborator

Hi @zdychacek

Thank you for your work, I like the promise API you propose but we also need to retain the callback functionality (I'd keep that default) and I'd prefer to be compatible with 0.8.x as long as possible.

I'd also like to get some more opinions on this :)

In the meantime, could you please edit README.md to describe the proxy as a separate feature, for example how "cookies" has been described.

@zdychacek
Copy link
Author

Hi @patricklodder,

it's not a problem to retain callback style along with the proxy feature. Going to rewrite that.

I will describe the usage of proxy feature in README.md as a separate feature then.

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.

2 participants