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

remove deprecated listen callback without accept or reject #212

Closed
timaschew opened this issue Aug 11, 2016 · 3 comments
Closed

remove deprecated listen callback without accept or reject #212

timaschew opened this issue Aug 11, 2016 · 3 comments
Milestone

Comments

@timaschew
Copy link
Contributor

timaschew commented Aug 11, 2016

In version 1.1 both functions has been deprecated:

client.event.listen(pattern, function(eventName, isSubscribed) {})
and
client.record.listen(pattern, function(match, isSubscribed){})

To do it the proper way you need to pass a third argument to the callback which provides two functions: accept and reject. One of them needs to be called within the callback.

listen(pattern, function(name, isSubscribed, response) {
  if (isSubscribed) {
    response.accept() // if you want to provide the event name / record name
    // otherwise call response.reject()
  } else {
    // stop providing the event name / record name
  }
})

For records the subscriber can check a boolean flag via aRecord.hasProvider or register a handler for the hasProviderChanged event for the same boolean flag.

For more details checkout the documentation

@timaschew timaschew added this to the 1.x milestone Aug 11, 2016
@ronag
Copy link

ronag commented Aug 11, 2016

Does this really need to be deprecated though? If arguments.length < 3 auto accept?

@timaschew
Copy link
Contributor Author

This could change the behaviour of your app since the feature was a bit broken before.
To avoid breaking changes we decided to keep the old behaviour and add a deprecated message instead.

@yasserf yasserf removed this from the 1.x milestone Oct 23, 2016
@AlexBHarley AlexBHarley added this to the 2.1 milestone Nov 30, 2016
@AlexBHarley
Copy link
Contributor

This has been resolved in the 2.0 release

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

No branches or pull requests

4 participants