fn
Declares a module function and the thread it runs on: fn.sync<() => number>().
Usage
Connect a reporting service
// modules/crash-service/crash-service.ts
import { defineModule, fn } from 'kuito';
export default defineModule('CrashService', {
start: fn.main<(key: string) => Promise<void>>(),
ios: { class: 'CrashServiceModule' },
android: { class: 'com.example.myapp.modules.crashservice.CrashServiceModule' },
});Properties and methods 3
| Name | Type | Required | Description |
|---|---|---|---|
sync | <F extends SyncFunction>() => Synchronous<F> | Yes | Runs on the JS thread and returns its value. Keep it fast, thread-safe and off UIKit and Views. |
main | QueuedDeclaration | Yes | Runs on the main (UI) thread. |
background | QueuedDeclaration | Yes | Runs on the module's own serial background thread, in call order. |
sync — method signatures
Signatures
<F extends SyncFunction>(): Synchronous<F>Type parameters
| Name | Constraint | Default |
|---|---|---|
F | SyncFunction | — |
Parameters
No parameters.
Returns
Synchronous<F>
main — method signatures
Signatures
<F extends AsyncFunction>(): FType parameters
| Name | Constraint | Default |
|---|---|---|
F | AsyncFunction | — |
Parameters
No parameters.
Returns
F
background — method signatures
Signatures
<F extends AsyncFunction>(): FType parameters
| Name | Constraint | Default |
|---|---|---|
F | AsyncFunction | — |
Parameters
No parameters.
Returns
F
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.