src/utils/Observer.js
function Observer(fn, observerInfo) {
	// call Subscribable constructor
	Subscribable.call(this);
	
	this.fn = fn;
	this.dependency = [];
	this.currentValue = null;
	this.observerInfo = observerInfo;
	
	// hard binded callbacks
	this._dependencyGetter = this.dependencyGetter.bind(this);
	
	this.call();
}
function Observer(fn, observerInfo) {
	// call Subscribable constructor
	Subscribable.call(this);
	
	this.fn = fn;
	this.dependency = [];
	this.currentValue = null;
	this.observerInfo = observerInfo;
	
	// hard binded callbacks
	this._dependencyGetter = this.dependencyGetter.bind(this);
	
	this.call();
}
function Observer ( fn , observerInfo ) { // call Subscribable constructor Subscribable . call ( this ) ; this . fn = fn ; this . dependency = [ ] ; this . currentValue = null ; this . observerInfo = observerInfo ; // hard binded callbacks this . _dependencyGetter = this . dependencyGetter . bind ( this ) ; this . call ( ) ; }
Observer is a subscribable which watches a function and each time some variable in it changes, it is called again and its return value is passed to subscribers.
Observer is a subscribable which watches a function and each time some variable in it changes it is called again and its return value is passed to subscribers .