22 lines
349 B
TypeScript
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");
|
|
}
|
|
}
|
|
|