Skip to content

Commit

Permalink
#47 resetting models
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Jul 19, 2013
1 parent 2b15937 commit fb909b5
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,34 @@ Cloudvisio.prototype.ready = function( layout ){
};

// reset all properties/data
Cloudvisio.prototype.reset = function( data ){
// reset data
Cloudvisio.prototype.reset = function(){
// variables
var data, options;
// count arguments
switch( arguments.length ){
case 1:
if( arguments[0] instanceof Array ){
data = arguments[0];
} else {
options = arguments[0];
}
break;
default:
data = arguments[0];
options = arguments[1];
break;
}
// fallbacks
data = data || false;
options = options || false;
if( data ) this.data( data, { reset: true });
// reset options
this.options = defaults;

if( options.options !== false ){
this.options = defaults;
}
if( options.models !== false ){
this.models = [];
}
};


Expand Down

0 comments on commit fb909b5

Please sign in to comment.