How can a plugin vue.js send $emit in the main application?

Did the plugin are logged so
let API = {
 install(Vue, options) {
 API.$AuthInfo = {user: {username: "}}
 Vue.prototype.$API = API
 // some actions

as a result, its use in vue like this.$API.callApi(params)

But I can't find how from the plugin callApi make sending type this.$root.$emit, because the root vue instance in the plug-in no.

How to reach the instance from the plug-in vue?
April 3rd 20 at 18:48
1 answer
April 3rd 20 at 18:50
Can be output event bus?
Maybe I just didn't want him to drag to the project. At the moment, got out so:
this plugin has an init method that is called from created App.vue, here there and handed over to the settings
API.init({'mode': this.run_mode, 'root':this.$root})

init(options) {
 if (options.mode == 'production') {
 apiLink = ''
 } else {
 apiLink = ''
 API.$root = options.root.

after that, it became possible in the plugin to use the usual this.$root.$emit() - Coby.Macejkovi commented on April 3rd 20 at 18:53

Find more questions by tags Vue.js