Skip to content

Commit

Permalink
added deepWatchOptions and deepWatchConfig properties
Browse files Browse the repository at this point in the history
  • Loading branch information
krispo committed Sep 15, 2015
1 parent 115ae81 commit 9606069
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions dist/angular-nvd3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**************************************************************************
* AngularJS-nvD3, v1.0.2-dev; MIT License; 15/09/2015 20:40
* AngularJS-nvD3, v1.0.2-dev; MIT License; 15/09/2015 20:47
* http://krispo.github.io/angular-nvd3
**************************************************************************/
(function(){
Expand All @@ -25,7 +25,9 @@
disabled: false,
autorefresh: true,
refreshDataOnly: false,
deepWatchOptions: true,
deepWatchData: false, // to increase performance by default
deepWatchConfig: true,
debounce: 10 // default 10ms, time silence to prevent refresh while multiple options changes at a time
};

Expand Down Expand Up @@ -337,7 +339,7 @@
// Watching on options changing
scope.$watch('options', nvd3Utils.debounce(function(newOptions){
if (!scope._config.disabled && scope._config.autorefresh) scope.api.refresh();
}, scope._config.debounce, true), true);
}, scope._config.debounce, true), scope._config.deepWatchOptions);

// Watching on data changing
scope.$watch('data', function(newData, oldData){
Expand All @@ -354,7 +356,7 @@
scope._config = angular.extend(defaultConfig, newConfig);
scope.api.refresh();
}
}, true);
}, scope._config.deepWatchConfig);

//subscribe on global events
angular.forEach(scope.events, function(eventHandler, event){
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-nvd3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/angular-nvd3.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
disabled: false,
autorefresh: true,
refreshDataOnly: false,
deepWatchOptions: true,
deepWatchData: false, // to increase performance by default
deepWatchConfig: true,
debounce: 10 // default 10ms, time silence to prevent refresh while multiple options changes at a time
};

Expand Down Expand Up @@ -333,7 +335,7 @@
// Watching on options changing
scope.$watch('options', nvd3Utils.debounce(function(newOptions){
if (!scope._config.disabled && scope._config.autorefresh) scope.api.refresh();
}, scope._config.debounce, true), true);
}, scope._config.debounce, true), scope._config.deepWatchOptions);

// Watching on data changing
scope.$watch('data', function(newData, oldData){
Expand All @@ -350,7 +352,7 @@
scope._config = angular.extend(defaultConfig, newConfig);
scope.api.refresh();
}
}, true);
}, scope._config.deepWatchConfig);

//subscribe on global events
angular.forEach(scope.events, function(eventHandler, event){
Expand Down

0 comments on commit 9606069

Please sign in to comment.