1import { Controller } from "@hotwired/stimulus"; 2 3export default class extends Controller { 4 static values = { 5 cacheKey: String, 6 pollInterval: { type: Number, default: 1000 }, 7 }; 8 9 connect() { 10 this.poll(); 11 } 12 13 disconnect() { 14 if (this.timeout) { 15 clearTimeout(this.timeout); 16 } 17 } 18 19 async poll() { 20 try { 21 const url = `/internal/grids/status?key=${encodeURIComponent(this.cacheKeyValue)}`; 22 const response = await fetch(url); 23 const data = await response.json(); 24 25 if (data.status === "ready") { 26 this.element.outerHTML = data.html; 27 } else { 28 this.timeout = setTimeout(() => this.poll(), this.pollIntervalValue); 29 } 30 } catch (error) { 31 console.error("Error polling for grid:", error); 32 this.timeout = setTimeout(() => this.poll(), this.pollIntervalValue); 33 } 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.