mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Avoid errors when rendering serverside (#3909)
This commit is contained in:
parent
3e94b9431a
commit
da1d1ca512
@ -56,4 +56,7 @@ plugins.push(require('./plugins/plugin.filler.js')(Chart));
|
||||
|
||||
Chart.plugins.register(plugins);
|
||||
|
||||
window.Chart = module.exports = Chart;
|
||||
module.exports = Chart;
|
||||
if (typeof window !== 'undefined') {
|
||||
window.Chart = Chart;
|
||||
}
|
||||
|
||||
@ -669,6 +669,11 @@ module.exports = function(Chart) {
|
||||
};
|
||||
// Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
helpers.requestAnimFrame = (function() {
|
||||
if (typeof window === 'undefined') {
|
||||
return function(callback) {
|
||||
callback();
|
||||
};
|
||||
}
|
||||
return window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user