Sha256: 0f90e81c167f49b04791eefb05e16c08321d1004843ef04abdc30390cf284f59

Contents?: true

Size: 1.42 KB

Versions: 15

Compression:

Stored size: 1.42 KB

Contents

JS.Command=new JS.Class('Command',{initialize:function(a){if(JS.isFn(a))a={execute:a};this._2=a;this._0=this._2.stack||null},execute:function(a){if(this._0)this._0._3();var b=this._2.execute;if(b)b.apply(this);if(this._0&&a!==false)this._0.push(this)},undo:function(){var exec=this._2.undo;if(exec)exec.apply(this)},extend:{Stack:new JS.Class({include:[JS.Observable||{},JS.Enumerable||{}],initialize:function(a){a=a||{};this._1=a.redo||null;this.clear()},forEach:function(a,b){if(!a)return this.enumFor('forEach');a=JS.Enumerable.toFn(a);for(var c=0,d=this._0.length;c<d;c++){if(this._0[c]!==undefined)a.call(b||null,this._0[c],c)}return this},clear:function(){this._0=[];this.length=this.pointer=0},_3:function(){if(this.pointer===0&&this._1&&this._1.execute)this._1.execute()},push:function(a){this._0.splice(this.pointer,this.length);this._0.push(a);this.length=this.pointer=this._0.length;if(this.notifyObservers)this.notifyObservers(this)},stepTo:function(a){if(a<0||a>this.length)return;var b,c;switch(true){case a>this.pointer:for(b=this.pointer,c=a;b<c;b++)this._0[b].execute(false);break;case a<this.pointer:if(this._1&&this._1.execute){this._1.execute();for(b=0,c=a;b<c;b++)this._0[b].execute(false)}else{for(b=0,c=this.pointer-a;b<c;b++)this._0[this.pointer-b-1].undo()}break}this.pointer=a;if(this.notifyObservers)this.notifyObservers(this)},undo:function(){this.stepTo(this.pointer-1)},redo:function(){this.stepTo(this.pointer+1)}})}});

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
spontaneous-0.2.0.beta1 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha7 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha6 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha5 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha4 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha3 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha2 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.2.0.alpha1 application/js/vendor/JS.Class-2.1.5/min/command.js
spontaneous-0.1.0.alpha1 application/js/vendor/JS.Class-2.1.5/min/command.js
acts_as_dashboard-0.4.1 generators/dashboard/templates/js.class-2.1.4/min/command.js
acts_as_dashboard-0.4.0 generators/dashboard/templates/js.class-2.1.4/min/command.js
acts_as_dashboard-0.3.3 generators/dashboard/templates/js.class-2.1.4/min/command.js
acts_as_dashboard-0.3.2 generators/dashboard/templates/js.class-2.1.4/min/command.js
acts_as_dashboard-0.3.0 generators/dashboard/templates/js.class-2.1.4/min/command.js
acts_as_dashboard-0.1.0 generators/dashboard/templates/js.class-2.1.4/min/command.js