Skip to content

Instantly share code, notes, and snippets.

@npras npras/watcher.js
Created Feb 20, 2017

Embed
What would you like to do?
VueJS - Implementing Computed Property - Part Two
class Watcher {
constructor(vm, valueFn) {
this.vm = vm;
this.getter = valueFn;
this.value = this.get();
}
get() {
let value;
const vm = this.vm;
value = this.getter.call(vm);
return value;
}
}
module.exports = Watcher;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.