TeaSpeak-Client/modules/shared/proxy/Test.ts

30 lines
721 B
TypeScript
Raw Normal View History

2020-08-23 15:26:27 -04:00
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 = () => {};
}