Skip to content

Commit

Permalink
Merge pull request #210 from chrismrutherford/master
Browse files Browse the repository at this point in the history
Allow config to be updated in refresh fn.  Useful for dynamically set…
  • Loading branch information
toorshia committed Mar 29, 2016
2 parents 0bca41e + ce021d6 commit e6dd23c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion justgage.js
Original file line number Diff line number Diff line change
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 e6dd23c

Please sign in to comment.