Open mazoqui opened 4 years ago
At plugin install method, the mixing is creating a Proxy instance for components that does not declare mqtt
Vue.mixin({ created() { let mqtt = this.$options['mqtt']; if (mqtt) { this.$options.mqtt = new Proxy({}, { set: (target, key, value) => { Emitter.addListener(key, value, this); target[key] = value; return true; }, deleteProperty: (target, key) => { Emitter.removeListener(key, this.$options.mqtt[key], this); delete target.key; return true; } }); Object.keys(mqtt).forEach((key) => { this.$options.mqtt[key] = mqtt[key]; }); } },` code seems to work without extra instance.
At plugin install method, the mixing is creating a Proxy instance for components that does not declare mqtt
Vue.mixin({ created() {
let mqtt = this.$options['mqtt'];
if (mqtt) { this.$options.mqtt = new Proxy({}, { set: (target, key, value) => { Emitter.addListener(key, value, this); target[key] = value; return true; }, deleteProperty: (target, key) => { Emitter.removeListener(key, this.$options.mqtt[key], this); delete target.key; return true; } }); Object.keys(mqtt).forEach((key) => { this.$options.mqtt[key] = mqtt[key]; }); } },` code seems to work without extra instance.