matrix-dimension/web/app/shared/directives/toggle-fullscreen.directive.ts

20 lines
455 B
TypeScript
Raw Normal View History

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