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

protocol.subscribe should accept callback argument #8

Open
jeffbcross opened this issue Sep 18, 2013 · 0 comments
Open

protocol.subscribe should accept callback argument #8

jeffbcross opened this issue Sep 18, 2013 · 0 comments
Assignees
Milestone

Comments

@jeffbcross
Copy link
Owner

In the present API, protocol.subscribe only accepts one argument, a binder instance. In the implementation of the subscribe method, the binder has to call binder.onProtocolChange when the data has changed in the protocol. The protocol shouldn't need to know what the method is called, and should accept a callback method instead.

Before:

app.service('myProtocol', function () {
  this.subscribe = function (binder) {
    socket.on('change', function (change) {


      binder.onProtocolChange.call(binder, [change]);


    });
});

After:

app.service('myProtocol', function () {
  this.subscribe = function (binder, callback) {
    socket.on('change', function (change) {


      callback.call(binder, [change]);


    });
});
@ghost ghost assigned jeffbcross Sep 18, 2013
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

No branches or pull requests

1 participant