Closed sn0rcha closed 7 years ago
sorry about the delay, for some reason I never got a notification for this issue.. that or I overlooked it terribly.
I'm not sure off the top of my head, but I'll try and get around to writing some tests for this soon. In the mean time, if you figure it out then I'd really appreciate a PR. :)
@sn0rcha @cklmercer I'm having this issue too, but I don't think it has to do with $off
, but rather the lifetime of Vue components. If you have two of the same component alive at the same time, and you're listening to an event on both of them, your event handler will effectively be called twice.
EDIT: for instance-based event connection, this technique might be more useful than the global event bus of vue-events
Tried to resolve this issue using https://www.npmjs.com/package/vue-event-handler Appreciate any success.
Thanks for the idea, worked well for me.
Hey There,
Thanks for the plugin, I'm having an issue unsubscribing from events tho.
In one component route I have in the mounted function:
Then in the beforeDestroy function:
However, if I navigate to a new route, then come back, the event gets fired twice when called.
if I call this.$events.$off() with no particular event specified, it unsubscribes.
Any ideas?