downthemall/windows/windowstate.ts
2019-08-26 19:50:06 +02:00

26 lines
444 B
TypeScript

"use strict";
// eslint-disable-next-line no-unused-vars
import { RawPort } from "../lib/browser";
// License: MIT
export class WindowState {
private readonly port: RawPort;
constructor(port: RawPort) {
this.port = port;
this.update = this.update.bind(this);
addEventListener("resize", this.update);
this.update();
}
update() {
if (!this.port) {
return;
}
this.port.postMessage("resized");
}
}