API reference
createEngine()
Create an engine. An ESM export of @kymoscope/sdk and Kymoscope.createEngine in the script build.
Signature
function createEngine(options?: EngineOptions): KymoscopeEngineOptions
| Name | Type | Description |
|---|---|---|
licenseKey | string | License key for this domain. Without a valid one, every mounted chart shows a small attribution badge. See Licensing. |
license | { get: () => Promise<string> } | Fetches license keys from your backend, which calls license-renew. Called at creation and again 7 days before the held key expires; a rejection, an invalid key or no answer within 30 s keeps the current key and retries every hour. With licenseKey too, that key is used until the first successful get. See Automatic renewal. |
limits | Partial<KymoscopeLimits>Default: unlimited | Quantity limits. See Limits and errors. |
mathChannels | MathChannelStoreAdapterDefault: in memory | Where math-channel changes are persisted. See Math channels. |
live.relay | LiveRelayConfig | Relay URL and credential provider for encrypted streams. Without it, only local streams work. |
beforeImport | () => boolean | void | Promise<boolean | void> | Runs before every datasets.importFiles call; return false to cancel it (rejects with import_vetoed). |
palette | string[] | Colors given to plotted datasets in order (the first plotted gets the first color, cycling); a color set with datasets.setColor still wins. Hex colors; defaults to DATASET_PALETTE. |
Engine members
| Name | Type | Description |
|---|---|---|
getState() | () => EngineState | The current immutable state snapshot. |
subscribe(listener) | (listener: () => void) => () => void | Called once per effective state change. Returns the unsubscribe function. |
on(event, listener) | (event: keyof EngineEvents, listener) => () => void | Engine events: change, limit, error, import. See Events. |
licensed | Promise<boolean> | Whether this page holds a valid license, after the first check: of licenseKey, or of the first license.get when given. Never rejects. Later renewals update isLicensed() and state.licensed, not this promise. |
isLicensed() | () => boolean | null | The current license state: null until the first check finishes, then true or false (it changes when a renewal succeeds or the held key stops verifying). |
setOptions(options) | (options: Partial<Omit<EngineOptions, 'licenseKey' | 'license'>>) => void | Update limits (merged into the current ones), the math-channel store, the relay, beforeImport or the palette at runtime. |
dispose() | () => void | Destroy every chart view, close live connections and free datasets. Later calls throw disposed. |
history | { undo(): void; redo(): void; clear(): void } | Undo/redo of the analysis; getState().history.canUndo / canRedo say whether there is a step. Cleared by io.openWorkbook, importWorkspace, restore and reset. See Undo and redo. |
datasets, folders, worksheets, charts, view, mathChannels, live, io, data | namespaces | See Engine namespaces. |