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

channel.users is not updated before 'userlist' event is emitted #146

Open
vith opened this issue Apr 26, 2018 · 1 comment
Open

channel.users is not updated before 'userlist' event is emitted #146

vith opened this issue Apr 26, 2018 · 1 comment

Comments

@vith
Copy link
Contributor

vith commented Apr 26, 2018

Using setTimeout with 0 delay can work around it.

@vith
Copy link
Contributor Author

vith commented May 31, 2018

Just stepped through the event being emitted. The listener I added is being called before the internal one here:

irc_client.on('userlist', (event) => {

This happens because I register my event listener at startup, but the channel object is created much later.

For now I will just use the user list supplied in the event args instead of reading it from the channel property. But perhaps we can avoid this surprise by having a separate internal EventEmitter that is emitted to first so all the internal state can be correct before any listeners are called by the public emitter.

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