Sha256: 9f778f3cddabbff3da95edc41986ac4c53576e0d9183812a9d7db8a5f97744be
Contents?: true
Size: 677 Bytes
Versions: 49
Compression:
Stored size: 677 Bytes
Contents
import { Controller } from "@hotwired/stimulus" export default class extends Controller { static targets = [ "button" ] connect() { this.hasButtonTarget && this.#hideButtonIfNotSupported() } toggle() { this.#fullScreenMode ? this.#exitFullscreen() : this.#requestFullscreen() } #hideButtonIfNotSupported() { this.buttonTarget.hidden = !this.#supportsFullScreen } #exitFullscreen() { document.exitFullscreen() } #requestFullscreen() { document.documentElement.requestFullscreen() } get #supportsFullScreen() { return this.element.requestFullscreen } get #fullScreenMode() { return document.fullscreenElement } }
Version data entries
49 entries across 49 versions & 1 rubygems