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

pusher.bind() not defined/supported #23

Closed
snaptopixel opened this issue Jun 5, 2020 · 5 comments
Closed

pusher.bind() not defined/supported #23

snaptopixel opened this issue Jun 5, 2020 · 5 comments

Comments

@snaptopixel
Copy link

snaptopixel commented Jun 5, 2020

Thank you for building this lib, I'm trying to use it but pusher.bind does not seem to be supported.

https://pusher.com/docs/channels/using_channels/events#binding-on-the-client

@nikolalsvk
Copy link
Owner

nikolalsvk commented Jun 8, 2020

Hey, @snaptopixel, thanks for opening this issue! Supporting pusher.bind is something we are interested in supporting.

Could you help us and explain how would you use such a feature? This will give an idea of how to create support for it, as well as prove some examples of how to use it.

@snaptopixel
Copy link
Author

Sure, thanks @nikolalsvk, I think the example shown on the Pusher docs is a decent case, multiple channels with the same event-name can be bound once.

In our frontend, we initialize pages as web-components. Rather than require Pusher to be configured in each component, we are passing a pre-configured Pusher instance to them.

Ideally we could also pre-subscribe to channels so that our page component(s) only need to be aware of the event name.

In that case you can have something like:

componentDidLoad() {
  this.pusher.bind('some-event-here')
}

Rather than

componentDidLoad() {
  const ch = this.pusher.subscribe('some-channel')
  ch.bind('some-event-here')
}

@nikolalsvk
Copy link
Owner

Hey, @snaptopixel, I made some progress and added support for pusher.bind. Can you take a look at the test I wrote and see if this is something you would use?

Also, if you have any more suggestions or input, I'd really appreciate it.

@snaptopixel
Copy link
Author

LGTM thanks much @nikolalsvk

@nikolalsvk
Copy link
Owner

Hey, @snaptopixel, I just released 0.3.2 so you can play with it if you want. Thanks for the idea :)

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

2 participants