I am currently reading out a language setting from the dom and setting it as a global
Vue.js variable like this:
const language = document.querySelector('html').getAttribute('lang');
Vue.prototype.$language = language;
It works fine but I have also seen this as an example from a Vue.js event bus:
Object.defineProperties(Vue.prototype, {
$bus: {
get() {
return EventBus;
}
}
});
What is the real difference between these two and is there possible a more preferred way of doing this?