1import { Controller } from "@hotwired/stimulus" 2import { Turbo } from "@hotwired/turbo-rails" 3 4export default class extends Controller { 5 static values = { 6 interval: { type: Number, default: 5000 } 7 } 8 9 connect() { 10 this.refreshTimer = null 11 this.scheduleRefresh() 12 } 13 14 disconnect() { 15 this.clearRefreshTimer() 16 } 17 18 scheduleRefresh() { 19 this.clearRefreshTimer() 20 this.refreshTimer = window.setTimeout(() => this.refresh(), this.intervalValue) 21 } 22 23 refresh() { 24 if (!this.element.isConnected) return 25 26 if (document.hidden) { 27 this.scheduleRefresh() 28 return 29 } 30 31 Turbo.visit(window.location.href, { action: "replace" }) 32 } 33 34 clearRefreshTimer() { 35 if (!this.refreshTimer) return 36 37 window.clearTimeout(this.refreshTimer) 38 this.refreshTimer = null 39 } 40}
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.