1.0.0 • Published 7 years ago

vue-observer v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Vue-observer

example

import { Watcher, observe } from 'vueObservable';

const obj = {
  a: 1,
  b: {
    c: 2
  }
}
const obValue = observe(obj).value;

const callback = function(oldValue, newValue) {

  document.write('value changed, the old value is ', oldValue, ', and this new value is ', newValue);
}

const watcher = new Watcher(obValue, function() {
  return this.a + this.b.c;
}, callback);

// do some change, then will call callback function auto; 
obValue.a = 2;

run example

npm run build 

then open example.html in your browser。

todo

  • add Set function
  • add Delete function