mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 08:42:19 +00:00
24 lines
435 B
TypeScript
24 lines
435 B
TypeScript
import { RpcPeer } from "../src/rpc";
|
|
|
|
const p1 = new RpcPeer('p1', 'p2', message => {
|
|
p2.handleMessage(message);
|
|
});
|
|
|
|
const p2 = new RpcPeer('p2', 'p1', message => {
|
|
p1.handleMessage(message);
|
|
});
|
|
|
|
class Foo {
|
|
}
|
|
|
|
p1.params['thing'] = new Foo();
|
|
|
|
async function test() {
|
|
const foo = await p2.getParam('thing');
|
|
foo.bar = 3;
|
|
if (foo.bar !== 3)
|
|
throw new Error('proxy custom property set failed');
|
|
}
|
|
|
|
test();
|