Skip to content

copper3d / Modules / Utils/kiwrious/configKiwrious

Module: Utils/kiwrious/configKiwrious

Table of contents

Variables

Functions

Variables

default

Const default: kiwriousType

The plugin's public surface, unchanged for callers: kiwrious.setBinUrl(), kiwrious.setWasm() and kiwrious.serialService.* all still work without awaiting anything. The first call that genuinely needs the module (connectAndReadAsync) is what triggers the import.

Cast because SerialService_kiwrious is declared with private fields, so nothing structural can satisfy it -- the facade forwards every public member.

Defined in

src/Utils/kiwrious/configKiwrious.ts:152

Functions

configKiwriousHeart

configKiwriousHeart(connectBtn, disconnectBtn, binUrl, wasmUrl, connectionCallback, heartDataCallback): Promise<void>

Now async: it awaits the plugin before wiring the buttons, so a click that lands immediately after cannot race the import. Callers that ignored the return value before still work -- the buttons are simply live one microtask-chain later.

Parameters

NameType
connectBtnHTMLButtonElement
disconnectBtnHTMLButtonElement
binUrlstring
wasmUrlstring
connectionCallback(isConnected: boolean) => void
heartDataCallback(heartData: any, status: string, hrVal: number) => void

Returns

Promise<void>

Defined in

src/Utils/kiwrious/configKiwrious.ts:172


loadKiwrious

loadKiwrious(): Promise<kiwriousType>

Imports the sensor plugin once and caches it. Concurrent callers share the import. Everything on the kiwrious facade below funnels through here, so callers only need this directly when they want to await the load.

Returns

Promise<kiwriousType>

Defined in

src/Utils/kiwrious/configKiwrious.ts:50