PageSourceSearch

https://wewere.online/assets/useLiveEvents-FNtQDf8X.js

js wewere.online collected 2026-10-08 09:22:27 UTC 1,228 bytes, 1 lines download raw bytes

1import{r}from"./client-CUTvk0f7.js";import{S as g}from"./config-Bjfj771K.js";function M(m={}){const d=m.maxEvents??500,u=m.types?.join(",")??"",[R,y]=r.useState([]),[S,v]=r.useState(!1),a=r.useRef(d);a.current=d;const w=r.useRef(new Set),x=r.useRef([]),p=2e3;return r.useEffect(()=>{let n=null,i=!1,l,c=1e3;const E=()=>{if(i)return;const L=u?`${g}?types=${encodeURIComponent(u)}`:g;n=new WebSocket(L),n.onopen=()=>{v(!0),c=1e3},n.onmessage=T=>{let s;try{s=JSON.parse(T.data)}catch(e){console.warn("[useLiveEvents] dropped unparseable frame:",e);return}if(!Array.isArray(s.events)){console.warn("[useLiveEvents] frame missing events array:",s);return}if(s.events.length===0)return;const f=w.current,o=x.current,h=s.events.filter(e=>e.id?f.has(e.id)?!1:(f.add(e.id),o.push(e.id),!0):(console.warn("[useLiveEvents] event without id (upstream bug):",e),!1));if(o.length>p){const e=o.length-p;for(let t=0;t<e;t++)f.delete(o[t]);o.splice(0,e)}h.length!==0&&y(e=>{const t=[...e,...h];return t.length>a.current?t.slice(t.length-a.current):t})},n.onclose=()=>{v(!1),!i&&(l=setTimeout(E,c),c=Math.min(c*2,15e3))},n.onerror=()=>{n?.close()}};return E(),()=>{i=!0,l&&clearTimeout(l),n?.close()}},[u]),{events:R,connected:S}}export{M as u};

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.