Improved new file/history

This commit is contained in:
Devine Lu Linvega
2018-02-05 10:09:46 +13:00
parent a440752f73
commit e98978249c
2 changed files with 9 additions and 4 deletions
+7 -1
View File
@@ -3,6 +3,12 @@ function History()
this.index = 0;
this.a = [];
this.clear = function()
{
this.a = [];
this.index = 0;
}
this.push = function(data)
{
if(this.index < this.a.length-1){
@@ -35,6 +41,6 @@ function History()
return copy(this.a[this.index]);
}
function copy(data){ return data.slice(0); }
function copy(data){ return data ? data.slice(0) : []; }
function clamp(v, min, max) { return v < min ? min : v > max ? max : v; }
}