30 lines
721 B
TypeScript
30 lines
721 B
TypeScript
import {ProxiedClass} from "./Definitions";
|
|
import {ObjectProxyClient} from "./Client";
|
|
import {ObjectProxyServer} from "./Server";
|
|
|
|
interface TextModal {
|
|
readonly events: {
|
|
onHide: () => void;
|
|
}
|
|
|
|
sayHi() : Promise<void>;
|
|
}
|
|
|
|
class TextModalImpl extends ProxiedClass<TextModal> implements TextModal {
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
|
|
async sayHi(): Promise<void> {
|
|
this.events.onHide();
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
let server = new ObjectProxyServer<TextModal>("", TextModalImpl);
|
|
let client = new ObjectProxyClient<TextModal>("");
|
|
|
|
const instance = await client.createNewInstance();
|
|
await instance.sayHi();
|
|
instance.events.onHide = () => {};
|
|
} |