Sha256: c136fc7794788c95c0a374e9b568b871349d880262550162cfe9b94e2f31f995
Contents?: true
Size: 1009 Bytes
Versions: 38
Compression:
Stored size: 1009 Bytes
Contents
import {controller, target} from '@github/catalyst' @controller class ZenModeButtonElement extends HTMLElement { @target button: HTMLElement inZenMode = false private deactivateZenMode() { this.inZenMode = false this.button.setAttribute('aria-pressed', 'false') if (document.exitFullscreen) { void document.exitFullscreen() } } private activateZenMode() { this.inZenMode = true this.button.setAttribute('aria-pressed', 'true') if (document.documentElement.requestFullscreen) { void document.documentElement.requestFullscreen() } } public performAction() { if (this.inZenMode) { this.deactivateZenMode() } else { this.activateZenMode() } } } declare global { interface Window { ZenModeButtonElement: typeof ZenModeButtonElement } } if (!window.customElements.get('zen-mode-button')) { window.ZenModeButtonElement = ZenModeButtonElement window.customElements.define('zen-mode-button', ZenModeButtonElement) }
Version data entries
38 entries across 38 versions & 1 rubygems