Skip to content

Commit afcd22e

Browse files
committed
fix: better support for virtual dom (animationFrame)
# Conflicts: # packages/toolset-revealer/valma/perspire.js
1 parent e7f38f2 commit afcd22e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/inspire/PerspireServer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default class PerspireServer {
5252
this.outputPath = outputPath;
5353
this.test = test;
5454
this.container = container;
55+
this.window = container.window;
5556
}
5657

5758
async start () {

packages/toolset-revealer/valma/perspire.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ exports.handler = async (yargv) => {
5959
global.document = container.window.document;
6060
global.navigator = container.window.navigator;
6161
global.WebSocket = require("ws"); // For networking in Node environments
62-
62+
global.requestAnimationFrame = (callback) => {
63+
setTimeout(callback, 0);
64+
};
65+
global.cancelAnimationFrame = (callback) => {
66+
setTimeout(callback, 0);
67+
};
6368
const PerspireServer = require("@valos/inspire/PerspireServer").default;
6469

6570
const vlm = yargv.vlm;
@@ -92,6 +97,7 @@ exports.handler = async (yargv) => {
9297
container
9398
});
9499
await server.start();
100+
95101
const interval = (typeof yargv.keepalive === "number") ? yargv.keepalive : (yargv.keepalive && 1);
96102
if (interval) {
97103
console.warn("Setting up keepalive render every", interval, "seconds");

0 commit comments

Comments
 (0)