fix headless tests on desktop

This commit is contained in:
Evan Almloff 2024-02-27 12:19:34 -06:00
parent 271b53e866
commit acbc1f6a47

View file

@ -51,11 +51,11 @@ fn handle_edits_code() -> String {
.then(bytes => {{ .then(bytes => {{
// In headless mode, the requestAnimationFrame callback is never called, so we need to run the bytes directly // In headless mode, the requestAnimationFrame callback is never called, so we need to run the bytes directly
if (headless) {{ if (headless) {{
interpreter.run_from_bytes(bytes); window.interpreter.run_from_bytes(bytes);
}} }}
else {{ else {{
requestAnimationFrame(() => {{ requestAnimationFrame(() => {{
interpreter.run_from_bytes(bytes); window.interpreter.run_from_bytes(bytes);
}}); }});
}} }}
window.interpreter.wait_for_request(headless); window.interpreter.wait_for_request(headless);