Incorrectly registered installation method for Vue 2.x #1
Description
Hello @steffans!
This library is what I was looking exactly for, thank you for creating it! The API is exactly what I want. But there's one problem... It doesn't work with Vue 2.x.
It doesn't work loaded directly using <script>
and it doesn't work in webpack build when imported.
Fiddle: https://jsfiddle.net/egjru2wq/2/
EDIT1: Upon further investigation of $events.listeners
it seems like the listeners aren't registered at all because I can't see my 'test' event listener there.
EDIT2: Yep. The problems lies in registering event listeners in events
property. See updated fiddle: https://jsfiddle.net/egjru2wq/3/
EDIT3: I think I've pinpointed the issue. I think the mixin is incorrectly installed. First of all the plugin installation method isn't exposed in install method (Writing a Plugin) and the second main thing is that mixin is registered on init
(index.js:18) instead of beforeCreate
(Migration from Vue 1.x - init renamed). — I'd create pull request myself but I don't have any experience in plugins that are backward compatible with Vue 1.x.
EDIT4: For reference - here's my modified dist/vue-event-manager.common.js that I'm now using (and it works!) with Vue 2.x: https://hastebin.com/qivukanoka.js