mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 03:00:13 +02:00
VR keyboard: the strip relay resyncs once per burst of new page contexts
Every executionContextCreated (Runtime.enable alone reports each existing context) started its own resync timer; one debounced timer now, as the injectors do.
This commit is contained in:
1 parent
378265389d
commit
0908713667
1 file changed
+4
-1
@@ -30,6 +30,9 @@ function cleanStyle(st) {
|
|||||||
}
|
}
|
||||||
const show = (state) => { lastState = state; live.vr?.(`window.__sfuiKbdStrip?.show(${JSON.stringify(state)})`); };
|
const show = (state) => { lastState = state; live.vr?.(`window.__sfuiKbdStrip?.show(${JSON.stringify(state)})`); };
|
||||||
const resync = () => live.steam?.('window.__sfuiSwipe?.remote?.sync()');
|
const resync = () => live.steam?.('window.__sfuiSwipe?.remote?.sync()');
|
||||||
|
// New contexts come in bursts; the injector re-patches ~3 s after the last.
|
||||||
|
let resyncTimer = null;
|
||||||
|
const resyncSoon = () => { clearTimeout(resyncTimer); resyncTimer = setTimeout(resync, 3500); };
|
||||||
|
|
||||||
function forward(side, payload) {
|
function forward(side, payload) {
|
||||||
let msg;
|
let msg;
|
||||||
@@ -55,7 +58,7 @@ async function connect(side) {
|
|||||||
ws.onmessage = (e) => {
|
ws.onmessage = (e) => {
|
||||||
const m = JSON.parse(e.data);
|
const m = JSON.parse(e.data);
|
||||||
if (m.method === 'Runtime.bindingCalled' && m.params.name === cfg.binding) forward(side, m.params.payload);
|
if (m.method === 'Runtime.bindingCalled' && m.params.name === cfg.binding) forward(side, m.params.payload);
|
||||||
else if (m.method === 'Runtime.executionContextCreated') setTimeout(resync, 3500); // the injector re-patches after ~3 s
|
else if (m.method === 'Runtime.executionContextCreated') resyncSoon();
|
||||||
};
|
};
|
||||||
const closed = new Promise((res) => { ws.onclose = res; });
|
const closed = new Promise((res) => { ws.onclose = res; });
|
||||||
send('Runtime.enable');
|
send('Runtime.enable');
|
||||||
|
|||||||
Reference in new issue
Block a user