can-simple-observable
Create an observable value.
new SimpleObservable(initialValue)
Creates an observable value that can be read, written, and observed using can-reflect.
Parameters
- initialValue
{*}
:The initial value of the observable.
Use
var obs = new SimpleObservable('one');
canReflect.getValue(obs); // -> "one"
canReflect.setValue(obs, 'two');
canReflect.getValue(obs); // -> "two"
function handler(newValue) {
// -> "three"
};
canReflect.onValue(obs, handler);
canReflect.setValue(obs, 'three');
canReflect.offValue(obs, handler);