nodulator
Version:
Complete NodeJS Framework for Restfull APIs
71 lines (70 loc) • 1.94 kB
JavaScript
// Generated by LiveScript 1.4.0
(function(){
var _Hacktiv, Hacktiv, Dependency, Value, Computation;
_Hacktiv = (function(){
_Hacktiv.displayName = '_Hacktiv';
var prototype = _Hacktiv.prototype, constructor = _Hacktiv;
_Hacktiv.active = false;
_Hacktiv.computations = [];
_Hacktiv.current = null;
_Hacktiv.Watch = function(f){
var ref$, comp, ref1$;
if ((ref$ = this.current) != null) {
ref$.Pause();
}
comp = new Computation(f);
if ((ref1$ = this.current) != null) {
ref1$.Resume();
}
return comp;
};
_Hacktiv.Pop = function(){
var comput;
comput = this.computations.pop();
this.SetCurrent(comput);
return comput;
};
_Hacktiv.AddComput = function(comput){
if (this.current != null) {
this.computations.push(this.current);
}
this.SetCurrent(comput);
return comput;
};
_Hacktiv.DontWatch = function(f){
var prev;
prev = this.current;
this.SetCurrent(null);
f();
return this.SetCurrent(prev);
};
_Hacktiv.SetCurrent = function(comput){
this.current = comput;
this.active = !!this.current;
return Hacktiv.active = this.active;
};
_Hacktiv.GetCurrent = function(){
return this.current;
};
_Hacktiv.Remove = function(comp){
return this.computations.splice(this.computations.indexOf(comp), 1);
};
function _Hacktiv(){}
return _Hacktiv;
}());
Hacktiv = function(f){
return _Hacktiv.Watch(f);
};
Hacktiv.DontWatch = function(f){
return _Hacktiv.DontWatch(f);
};
Hacktiv._ = _Hacktiv;
Hacktiv.active = false;
Dependency = require('./Dependency');
Value = require('./Value');
Hacktiv.Value = Value;
Hacktiv.Dependency = Dependency;
module.exports = Hacktiv;
Hacktiv.Computation = Computation;
Computation = require('./Computation');
}).call(this);