From f936060d3e09cccf006c43879669d5edb7e85c7b Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 20 Mar 2014 01:36:23 +0400 Subject: [PATCH] moved the Data init code to ._reset() instance method (still thinking about it)... Signed-off-by: Alex A. Naanou --- ui/data4.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/data4.js b/ui/data4.js index 2fb0f6e2..039b3993 100755 --- a/ui/data4.js +++ b/ui/data4.js @@ -131,6 +131,16 @@ var DataClassPrototype = { // NOTE: ribbons are sparse... // var DataPrototype = { + _reset: function(){ + this.base = null + this.current = null + this.order = [] + this.ribbon_order = [] + this.ribbons = {} + + this._gid_cache = [] + }, + // util methods... compactSparseList: function(list){ return list.filter(function(){return true}) @@ -900,17 +910,11 @@ function Data(json){ obj = this } - obj.base = null - obj.current = null - obj.order = [] - obj.ribbon_order = [] - obj.ribbons = {} - - obj._gid_cache = [] - // load initial state... if(json != null){ obj.loadJSON(json) + } else { + obj._reset() } return obj