Override DomEvent.requestAnimationFrame() in Node.js to avoid setInterval() timers

This commit is contained in:
Jürg Lehni 2016-01-27 13:02:50 +01:00
parent 414742459d
commit b56d18d6a4
2 changed files with 7 additions and 0 deletions

View file

@ -22,6 +22,8 @@ paper = new (PaperScope.inject(Base.exports, {
Base: Base,
Numerical: Numerical,
Key: Key,
DomEvent: DomEvent,
DomElement: DomElement,
// Export jsdom document and window too, for Node.js
document: document,
window: window

View file

@ -71,6 +71,11 @@ module.exports = function(paper) {
Canvas: '#createCanvas'
});
// Override requestAnimationFrame() to avoid setInterval() timers.
paper.DomEvent.requestAnimationFrame = function(callback) {
process.nextTick(callback);
};
// Node.js based image exporting code.
paper.CanvasView.inject({
// DOCS: CanvasView#exportFrames(param);