Documentation / @etherfold/browser / IndexerConnectOptions
Type Alias: IndexerConnectOptions ​
IndexerConnectOptions =
IndexerPortOptions&object
Defined in: packages/browser/src/host/port.ts:56
WHAT A TAB SAYS WHEN IT CONNECTS: how the port looks after the host's lifetime (IndexerPortOptions), and what it hands the host.
const indexer = connectToIndexerHost(
dedicatedWorkerHost(() => new Worker(new URL('./indexer.worker.ts', import.meta.url), {type: 'module'})),
{provider: window.ethereum, settings: {source, config, publication: {locations: [PUBLICATION]}}},
);The two are the provider and the cloneable settings a worker entry may LEAVE OUT, the way webevm's createWorkerNode({worker, ...options}) passes its options with the connection: a worker entry holds the code, and the tab holds what it only knows at run time. They are sent FIRST, on every host this port obtains, so a restarted host is told again.
Type Declaration ​
onConnect? ​
readonlyoptionalonConnect?: (outcome) =>void
BE TOLD WHETHER EACH HOST TOOK WHAT THIS TAB HANDED IT: called once per host this port obtains (the first, and every restart), with where the fold is where it was accepted, or with the refusal where it was not (by name: HostSettingsConflictError, whose fields name the settings that disagree; or the reason the settings or the provider could not be handed over at all).
A refusal is ALSO logged, since it is a disagreement between a worker entry and the tab that comes out of the same build, and an app that passed no callback must not be left with a host waiting for ever and nothing said. Not called where nothing is handed over.
Parameters ​
outcome ​
Returns ​
void
provider? ​
readonlyoptionalprovider?:IndexerProvider
THE CHAIN, for a host whose entry built none: a provider object this tab serves (a wallet), a MessagePort served elsewhere (a node in another worker, so requests go worker to worker), or a function returning such a port, called once per host. See IndexerProvider.
settings? ​
readonlyoptionalsettings?:HostSettings
What the host folds with, where its entry left it out. See HostSettings.