Skip to content

Commit

Permalink
Allow config to be updated in refresh fn. Useful for dynamically sett…
Browse files Browse the repository at this point in the history
…ing decimal places etc.
  • Loading branch information
Christopher Rutherford committed Mar 29, 2016
1 parent 0bca41e commit ce021d6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion justgage.js
Expand Up @@ -857,11 +857,20 @@ JustGage = function(config) {
};

/** Refresh gauge level */
JustGage.prototype.refresh = function(val, max) {
JustGage.prototype.refresh = function(val, max, config) {

var obj = this;
var displayVal, color, max = max || null;

if(config && (typeof config === "object")) {
for(var key in config) {
if(!config.hasOwnProperty(key)) {
continue;
}
obj.config[key] = config[key];
}
}

// set new max
if (max !== null) {
obj.config.max = max;
Expand Down

0 comments on commit ce021d6

Please sign in to comment.