Documentation / @etherfold/browser / connectToIndexerHost
Function: connectToIndexerHost() ​
connectToIndexerHost(
access,options?):IndexerPort
Defined in: packages/browser/src/host/port.ts:368
HOLD A HOST that is not this thread.
const indexer = connectToIndexerHost(
dedicatedWorkerHost(new Worker(new URL('./indexer.worker.ts', import.meta.url), {type: 'module'})),
);
const {lastToBlock, latestBlock} = await indexer.progress();It knows nothing about workers. The first argument is the ONE thing a hosting shape differs in, which is why choosing a shape is a different call rather than a flag threaded through this one.
It also owns the host's LIFETIME ​
A host can stop existing -- browsers evict workers -- and the four things that then happen are this function's (ADR-0082): the app is TOLD (onHostDeath), every call in flight REJECTS with an IndexerHostDiedError, another host is STARTED through the shape's own reopen, and the fold RESUMES from the cursor without anything here telling it where to start (ADR-0027). The second argument is what a tab may say about that; the defaults are in resolvePortOptions and are meant to be left alone.