mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
35 lines
872 B
TypeScript
35 lines
872 B
TypeScript
import { Component, OnDestroy, OnInit } from "@angular/core";
|
|
import * as screenfull from "screenfull";
|
|
|
|
@Component({
|
|
selector: "my-fullscreen-button",
|
|
templateUrl: "fullscreen-button.component.html",
|
|
styleUrls: ["fullscreen-button.component.scss"],
|
|
})
|
|
export class FullscreenButtonComponent implements OnDestroy, OnInit {
|
|
public isFullscreen = false;
|
|
|
|
private listener = null;
|
|
|
|
constructor() {
|
|
// Do stuff
|
|
}
|
|
|
|
public ngOnInit(): void {
|
|
// @ts-ignore
|
|
this.listener = screenfull.on("change", () => {
|
|
// @ts-ignore
|
|
this.isFullscreen = screenfull.isFullscreen;
|
|
});
|
|
// @ts-ignore
|
|
this.isFullscreen = screenfull.isFullscreen;
|
|
}
|
|
|
|
public ngOnDestroy(): void {
|
|
if (this.listener) {
|
|
// @ts-ignore
|
|
screenfull.off(this.listener);
|
|
}
|
|
}
|
|
}
|