Skip to content

Commit

Permalink
[fix] enforce sideffects for event listeners registration
Browse files Browse the repository at this point in the history
  • Loading branch information
smee committed Apr 14, 2015
1 parent d342a9a commit b44296a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
3 changes: 0 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@
},
"devDependencies": {
"angular-mocks": "latest"
},
"resolutions": {
"crossfilter": "~1.3.0"
}
}
7 changes: 4 additions & 3 deletions dist/angular-dc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define(['angular', 'dc', 'lodash', 'd3'], function(angular, dc, lodash, d3) {
return (root['angularDc'] = factory(angular, dc, lodash, d3));
define(['angular', 'dc', 'lodash', 'd3'], function(a0, b1, c2, d3) {
return (root['angularDc'] = factory(a0, b1, c2, d3));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
Expand Down Expand Up @@ -88,7 +88,8 @@
// Register the eventHandlers with the chart (Dc.js)
eventHandlers.each(function(handler, evt) {
chart.on(evt, handler);
});
}).value();
// run the chain to enforce side effects (registration of handlers), ignore the result
// Run the postSetupChart callback, if provided
if (_.isFunction(options.postSetupChart)) {
options.postSetupChart(chart, options);
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-dc.min.js

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

4 changes: 2 additions & 2 deletions src/angular-dc.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ angularDc.directive('dcChart', ['$timeout',
// Register the eventHandlers with the chart (Dc.js)
eventHandlers.each(function(handler, evt) {
chart.on(evt, handler);
});

}).value(); // run the chain to enforce side effects (registration of handlers), ignore the result
// Run the postSetupChart callback, if provided
if (_.isFunction(options.postSetupChart)) {
options.postSetupChart(chart, options);
Expand Down

0 comments on commit b44296a

Please sign in to comment.