Skip to content

Commit

Permalink
Merge pull request chartist-js#636 from BlackPepperSoftware/develop
Browse files Browse the repository at this point in the history
Fix updateCurrentOptions to expect a media query event
  • Loading branch information
gionkunz committed Mar 11, 2016
2 parents 3ccd365 + 2e3685c commit 537ec25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ var Chartist = {
mediaQueryListeners = [],
i;

function updateCurrentOptions(preventChangedEvent) {
function updateCurrentOptions(mediaEvent) {
var previousOptions = currentOptions;
currentOptions = Chartist.extend({}, baseOptions);

Expand All @@ -955,7 +955,7 @@ var Chartist = {
}
}

if(eventEmitter && !preventChangedEvent) {
if(eventEmitter && mediaEvent) {
eventEmitter.emit('optionsChanged', {
previousOptions: previousOptions,
currentOptions: currentOptions
Expand All @@ -979,8 +979,8 @@ var Chartist = {
mediaQueryListeners.push(mql);
}
}
// Execute initially so we get the correct options
updateCurrentOptions(true);
// Execute initially without an event argument so we get the correct options
updateCurrentOptions();

return {
removeMediaQueryListeners: removeMediaQueryListeners,
Expand Down

0 comments on commit 537ec25

Please sign in to comment.