is there a way to listen for a property call on a JavaScript Class
for example when i go something like this:
myForm = new Form(); myForm.name = 'Name'; -> when i set the name i dont only want to set the property but i also want to update my Vuex store. Same thing with get i would like to read from Vuex store.
I knoew there are thins like Proxy but for this i need to wrap my Class with a Proxy object. Not so sure if i like this.
module.exports = new Proxy(new Form({}), { get (receiver, name) { console.log('getting property from Vuex Store'); } }); What i need is something like this:
module.exports = class Form { //this should be triggered when form.something get(property) { return this[property]; } //this should be triggered when from.something = 'something' set(property, value) { return this[property] = value; } }; it there a best practice for this?