1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 static targets = ["frame"] 5 connect() { 6 this.abort = new AbortController() 7 window.addEventListener("message", event => { 8 if (event.origin !== location.origin || event.source !== this.frameTarget.contentWindow) return 9 if (!["lb-component:resize", "lb-course:resize"].includes(event.data?.type) || !Number.isFinite(event.data.height)) return 10 this.frameTarget.style.height = `${Math.min(2400, Math.max(360, Math.ceil(event.data.height)))}px` 11 }, {signal: this.abort.signal}) 12 this.observer = new IntersectionObserver(entries => { 13 if (!entries[0].isIntersecting) this.pause() 14 }) 15 this.observer.observe(this.element) 16 document.addEventListener("visibilitychange", () => { if (document.hidden) this.pause() }, {signal: this.abort.signal}) 17 } 18 pause() { 19 for (const type of ["lb-component:pause", "lb-course:pause"]) this.frameTarget.contentWindow?.postMessage({type}, location.origin) 20 } 21 disconnect() { this.pause(); this.abort.abort(); this.observer.disconnect() } 22}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.