2017-10-09 23:24:12 -04:00
|
|
|
import { Directive, HostListener } from "@angular/core";
|
2017-10-10 00:00:29 -04:00
|
|
|
import * as screenfull from "screenfull";
|
2017-10-09 23:24:12 -04:00
|
|
|
|
|
|
|
@Directive({
|
2017-10-10 00:00:29 -04:00
|
|
|
selector: "[myToggleFullscreen]",
|
2017-10-09 23:24:12 -04:00
|
|
|
})
|
|
|
|
export class ToggleFullscreenDirective {
|
|
|
|
|
2017-12-09 18:34:59 -05:00
|
|
|
@HostListener("click")
|
|
|
|
onClick() {
|
2017-10-09 23:24:12 -04:00
|
|
|
// HACK: This should be behind a service in the event the library changes
|
2019-04-13 16:37:56 -04:00
|
|
|
// @ts-ignore
|
2021-08-11 17:41:29 -04:00
|
|
|
if (screenfull.isEnabled) {
|
2019-04-13 16:37:56 -04:00
|
|
|
// @ts-ignore
|
2017-10-09 23:24:12 -04:00
|
|
|
screenfull.toggle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|