2017-10-09 23:24:12 -04:00
|
|
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
2017-10-10 00:00:29 -04:00
|
|
|
import * as screenfull from "screenfull";
|
2017-10-09 23:24:12 -04:00
|
|
|
|
|
|
|
@Component({
|
2021-09-01 19:01:01 -04:00
|
|
|
selector: "app-fullscreen-button",
|
2017-10-09 23:24:12 -04:00
|
|
|
templateUrl: "fullscreen-button.component.html",
|
|
|
|
styleUrls: ["fullscreen-button.component.scss"],
|
|
|
|
})
|
|
|
|
export class FullscreenButtonComponent implements OnDestroy, OnInit {
|
|
|
|
public isFullscreen = false;
|
|
|
|
|
|
|
|
private listener = null;
|
|
|
|
|
|
|
|
constructor() {
|
2021-09-01 19:01:01 -04:00
|
|
|
// Do stuff
|
2017-10-09 23:24:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public ngOnInit(): void {
|
2021-09-01 19:01:01 -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
|
2017-10-09 23:24:12 -04:00
|
|
|
this.isFullscreen = screenfull.isFullscreen;
|
|
|
|
});
|
2019-04-13 16:37:56 -04:00
|
|
|
// @ts-ignore
|
2017-10-09 23:24:12 -04:00
|
|
|
this.isFullscreen = screenfull.isFullscreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ngOnDestroy(): void {
|
|
|
|
if (this.listener) {
|
2019-04-13 16:37:56 -04:00
|
|
|
// @ts-ignore
|
2017-10-09 23:24:12 -04:00
|
|
|
screenfull.off(this.listener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|