1import { Controller } from "@hotwired/stimulus" 2 3// QuickBooks can take tens of seconds to return a chart of accounts. Frames in 4// collapsed settings panels should not make that request until someone opens 5// the panel. A visible setup step still loads immediately because it is the 6// next action the staff member needs to complete. 7export default class extends Controller { 8 static values = { src: String } 9 10 connect() { 11 this.details = this.element.closest("details") 12 this.toggleHandler = this.loadIfVisible.bind(this) 13 14 if (this.details) { 15 this.details.addEventListener("toggle", this.toggleHandler) 16 this.loadIfVisible() 17 } else { 18 this.load() 19 } 20 } 21 22 disconnect() { 23 this.details?.removeEventListener("toggle", this.toggleHandler) 24 } 25 26 loadIfVisible() { 27 if (this.details?.open) this.load() 28 } 29 30 load() { 31 if (!this.hasSrcValue || this.element.hasAttribute("src")) return 32 33 this.element.setAttribute("src", this.srcValue) 34 } 35}
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.