ably / ably-js

Javascript, Node, Typescript, React, React Native client library SDK for Ably realtime messaging service
https://ably.com/download
Apache License 2.0
316 stars 55 forks source link

Reconsider usage of `this` in `EventEmitter` listeners #1454

Open lawrence-forooghian opened 1 year ago

lawrence-forooghian commented 1 year ago

See MMB-328; I've created a corresponding issue here since ideally we'd like to keep the Spaces EventEmitter API the same as that of ably-js’s corresponding class (my understanding is that we'd like to eventually remove Spaces’ class and use that of ably-js).

As I mentioned on Slack:

It’s less obviously an issue in ably-js [than in Spaces], because usually (with the exception of the update event) the event name coincides with the name of the state that the emitting object has transitioned to, and this state is accessible via the current property of the state change that’s passed as an argument to the listener.

In ably-js, we may also want to maintain the usage of this for backwards compatibility, alongside a new argument-based way of exposing the event name.

┆Issue is synchronized with this Jira Story by Unito

sync-by-unito[bot] commented 1 year ago

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3884