MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / pollEvents

Function pollEvents

packages/node/src/backend/nodeBackend.ts:841–866  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

839 },
840
841 pollEvents(): Promise<BackendEventBatch> {
842 if (disposed) return Promise.reject(new Error("NodeBackend: disposed"));
843 if (fatal !== null) return Promise.reject(fatal);
844 if (stopRequested) return Promise.reject(new Error("NodeBackend: stopped"));
845
846 const queued = eventQueue.shift();
847 if (queued !== undefined) {
848 const buf = queued.batch;
849 const bytes = new Uint8Array(buf, 0, queued.byteLen);
850 let released = false;
851 return Promise.resolve({
852 bytes,
853 droppedBatches: queued.droppedSinceLast,
854 release: () => {
855 if (released) return;
856 released = true;
857 if (disposed) return;
858 send({ type: "eventsAck", buffer: buf }, [buf]);
859 },
860 });
861 }
862
863 const d = deferred<BackendEventBatch>();
864 eventWaiters.push(d);
865 return d.promise;
866 },
867
868 postUserEvent(tag: number, payload: Uint8Array): void {
869 if (disposed) throw new Error("NodeBackend: disposed");

Callers

nothing calls this directly

Calls 4

sendFunction · 0.85
resolveMethod · 0.80
deferredFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected