fn
Declares a module function and the thread it runs on: fn.sync<() => number>().
Verwendung
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' },
});Eigenschaften und Methoden 3
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
sync | <F extends SyncFunction>() => Synchronous<F> | Ja | Runs on the JS thread and returns its value. Keep it fast, thread-safe and off UIKit and Views. |
main | QueuedDeclaration | Ja | Runs on the main (UI) thread. |
background | QueuedDeclaration | Ja | Runs on the module's own serial background thread, in call order. |
sync — Methodensignaturen
Signaturen
<F extends SyncFunction>(): Synchronous<F>Typparameter
| Name | Einschränkung | Standard |
|---|---|---|
F | SyncFunction | — |
Parameter
Keine Parameter.
Rückgabe
Synchronous<F>
main — Methodensignaturen
Signaturen
<F extends AsyncFunction>(): FTypparameter
| Name | Einschränkung | Standard |
|---|---|---|
F | AsyncFunction | — |
Parameter
Keine Parameter.
Rückgabe
F
background — Methodensignaturen
Signaturen
<F extends AsyncFunction>(): FTypparameter
| Name | Einschränkung | Standard |
|---|---|---|
F | AsyncFunction | — |
Parameter
Keine Parameter.
Rückgabe
F
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.