mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Override DomEvent.requestAnimationFrame() in Node.js to avoid setInterval() timers
This commit is contained in:
parent
414742459d
commit
b56d18d6a4
2 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue