Move optionsProvider into setTimeout

This commit is contained in:
Will 2014-10-17 11:33:56 -04:00
parent c4b307c6c5
commit 07b047647d
3 changed files with 10 additions and 10 deletions

View File

@ -295,12 +295,12 @@
window.addEventListener('resize', update);
// Obtain current options based on matching media queries (if responsive options are given)
// This will also register a listener that is re-creating the chart based on media changes
optionsProvider = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, eventEmitter);
// Using event loop for first draw to make it possible to register event listeners in the same call stack where
// the chart was created.
setTimeout(function() {
// Obtain current options based on matching media queries (if responsive options are given)
// This will also register a listener that is re-creating the chart based on media changes
optionsProvider = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, eventEmitter);
createChart(optionsProvider.currentOptions);
}, 0);

View File

@ -379,12 +379,12 @@
window.addEventListener('resize', update);
// Obtain current options based on matching media queries (if responsive options are given)
// This will also register a listener that is re-creating the chart based on media changes
optionsProvider = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, eventEmitter);
// Using event loop for first draw to make it possible to register event listeners in the same call stack where
// the chart was created.
setTimeout(function() {
// Obtain current options based on matching media queries (if responsive options are given)
// This will also register a listener that is re-creating the chart based on media changes
optionsProvider = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, eventEmitter);
createChart(optionsProvider.currentOptions);
}, 0);

View File

@ -325,12 +325,12 @@
window.addEventListener('resize', update);
// Obtain current options based on matching media queries (if responsive options are given)
// This will also register a listener that is re-creating the chart based on media changes
optionsProvider = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, eventEmitter);
// Using event loop for first draw to make it possible to register event listeners in the same call stack where
// the chart was created.
setTimeout(function() {
// Obtain current options based on matching media queries (if responsive options are given)
// This will also register a listener that is re-creating the chart based on media changes
optionsProvider = Chartist.optionsProvider(defaultOptions, options, responsiveOptions, eventEmitter);
createChart(optionsProvider.currentOptions);
}, 0);
@ -347,4 +347,4 @@
return api;
};
}(window, document, Chartist));
}(window, document, Chartist));