fix headless windows
This commit is contained in:
1 parent
0e3fd225a8
commit
8984482b63
4 files changed
+18
-9
No files matched your search
@@ -51,15 +51,21 @@ fn main() {
|
||||
}"#;
|
||||
let polling_request = format!(
|
||||
r#"// Poll for requests
|
||||
window.interpreter.wait_for_request = () => {{
|
||||
window.interpreter.wait_for_request = (headless) => {{
|
||||
fetch(new Request("{EDITS_PATH}"))
|
||||
.then(response => {{
|
||||
response.arrayBuffer()
|
||||
.then(bytes => {{
|
||||
requestAnimationFrame(() => {{
|
||||
// In headless mode, the requestAnimationFrame callback is never called, so we need to run the bytes directly
|
||||
if (headless) {{
|
||||
run_from_bytes(bytes);
|
||||
}});
|
||||
window.interpreter.wait_for_request();
|
||||
}}
|
||||
else {{
|
||||
requestAnimationFrame(() => {{
|
||||
run_from_bytes(bytes);
|
||||
}});
|
||||
}}
|
||||
window.interpreter.wait_for_request(headless);
|
||||
}});
|
||||
}})
|
||||
}}"#
|
||||
|
||||
Reference in new issue
Block a user