mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -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,
|
Base: Base,
|
||||||
Numerical: Numerical,
|
Numerical: Numerical,
|
||||||
Key: Key,
|
Key: Key,
|
||||||
|
DomEvent: DomEvent,
|
||||||
|
DomElement: DomElement,
|
||||||
// Export jsdom document and window too, for Node.js
|
// Export jsdom document and window too, for Node.js
|
||||||
document: document,
|
document: document,
|
||||||
window: window
|
window: window
|
||||||
|
|
|
@ -71,6 +71,11 @@ module.exports = function(paper) {
|
||||||
Canvas: '#createCanvas'
|
Canvas: '#createCanvas'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Override requestAnimationFrame() to avoid setInterval() timers.
|
||||||
|
paper.DomEvent.requestAnimationFrame = function(callback) {
|
||||||
|
process.nextTick(callback);
|
||||||
|
};
|
||||||
|
|
||||||
// Node.js based image exporting code.
|
// Node.js based image exporting code.
|
||||||
paper.CanvasView.inject({
|
paper.CanvasView.inject({
|
||||||
// DOCS: CanvasView#exportFrames(param);
|
// DOCS: CanvasView#exportFrames(param);
|
||||||
|
|
Loading…
Reference in a new issue