TeaSpeak-Client/modules/shared/proxy/Test.ts
2020-08-23 21:26:27 +02:00

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 = () => {};
}