Load remote UI on intent and preserve synchronous host hooks

This commit is contained in:
Jonathan Sykes
2026-10-08 04:41:30 +08:00
parent 5fb9564468
commit 8e7fa1959a
6 changed files with 710 additions and 677 deletions

View File

@@ -38,3 +38,13 @@ test('eager shell and Settings definitions load before app state and defer readi
const views=readFileSync(join(__dirname,'views-core.js'),'utf8');
assert.ok(views.includes('async function renderSettings()'));
});
test('remote facade preserves synchronous no-session and loaded changed hooks',()=>{
const source=app.match(/\/\* Remote facade \*\/([\s\S]*?)\/\* End remote facade \*\//)?.[1];
assert.ok(source,'remote facade is present');
const context=require('node:vm').createContext({window:{},Lazy:{proxy:()=>({}),onLoad(){}}});
require('node:vm').runInContext(source+';globalThis.api=Remote;',context);
assert.equal(context.api.changed(),undefined);
let calls=0;context.window.YT={Remote:{changed:()=>{calls++;return 'sync';}}};
assert.equal(context.api.changed(),'sync');assert.equal(calls,1);
});