matrix-dimension/web/app/elements/fullscreen-button/fullscreen-button.component.ts

36 lines
881 B
TypeScript
Raw Normal View History

import { Component, OnDestroy, OnInit } from "@angular/core";
2017-10-10 00:00:29 -04:00
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 {
2019-04-13 16:37:56 -04:00
// @ts-ignore
2017-10-10 00:00:29 -04:00
this.listener = screenfull.on("change", () => {
2019-04-13 16:37:56 -04:00
// @ts-ignore
this.isFullscreen = screenfull.isFullscreen;
});
2019-04-13 16:37:56 -04:00
// @ts-ignore
this.isFullscreen = screenfull.isFullscreen;
}
public ngOnDestroy(): void {
if (this.listener) {
2019-04-13 16:37:56 -04:00
// @ts-ignore
screenfull.off(this.listener);
}
}
}