downthemall/windows/windowstate.ts
2019-08-20 16:41:37 +02:00

22 lines
349 B
TypeScript

"use strict";
// License: MIT
export class WindowState {
private readonly port: any;
constructor(port: any) {
this.port = port;
this.update = this.update.bind(this);
addEventListener("resize", this.update);
this.update();
}
update() {
if (!this.port) {
return;
}
this.port.postMessage("resized");
}
}