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

Event listeners without store #5

Closed
xtrinch opened this issue Jul 3, 2017 · 1 comment
Closed

Event listeners without store #5

xtrinch opened this issue Jul 3, 2017 · 1 comment

Comments

@xtrinch
Copy link

xtrinch commented Jul 3, 2017

How exactly can I listen to events if I do not have a store?

I've tried this in my created method if my main component, but it's not firing:

this.$options.sockets.SOCKET_ONMESSAGE = (data) => {console.log("a message")}

@nathantsoi
Copy link
Owner

try:

this.$options.sockets.onmessage = (data) => {console.log("a message")}

see https://github.com/nathantsoi/vue-native-websocket/blob/master/src/Observer.js#L21-L27 for more

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

2 participants