1import { connectStreamSource, disconnectStreamSource } from "@hotwired/turbo"; 2var TurboMercureStreamSourceElement = class extends HTMLElement { 3 connectedCallback() { 4 const src = this.getAttribute("src"); 5 if (null === src) throw new Error("The \"src\" attribute is required on <turbo-mercure-stream-source>."); 6 this.es = new EventSource(src, { withCredentials: this.hasAttribute("private") }); 7 connectStreamSource(this.es); 8 this.es.addEventListener("open", () => this.setAttribute("connected", "")); 9 this.es.addEventListener("error", () => this.removeAttribute("connected")); 10 } 11 disconnectedCallback() { 12 if (this.es) { 13 disconnectStreamSource(this.es); 14 this.es.close(); 15 this.es = void 0; 16 } 17 this.removeAttribute("connected"); 18 } 19 attributeChangedCallback() { 20 if (this.es) { 21 this.disconnectedCallback(); 22 this.connectedCallback(); 23 } 24 } 25}; 26TurboMercureStreamSourceElement.observedAttributes = ["src", "private"]; 27if (!customElements.get("turbo-mercure-stream-source")) customElements.define("turbo-mercure-stream-source", TurboMercureStreamSourceElement);
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.