FunctionDeclarations
Declares, in a native module's spec, on which thread each of its functions runs.
Utilisation
Connect a reporting service
Ce type est utilisé par fn
// 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' },
});Déclaration du type
export interface FunctionDeclarations {
/** Runs on the JS thread and returns its value. Keep it fast, thread-safe and off UIKit and Views. */
sync<F extends SyncFunction>(): Synchronous<F>;
/** Runs on the main (UI) thread. */
main: QueuedDeclaration;
/** Runs on the module's own serial background thread, in call order. */
background: QueuedDeclaration;
}Membres 3
| Nom | Type | Requis | Description |
|---|---|---|---|
sync | <F extends SyncFunction>() => Synchronous<F> | Oui | Runs on the JS thread and returns its value. Keep it fast, thread-safe and off UIKit and Views. |
main | QueuedDeclaration | Oui | Runs on the main (UI) thread. |
background | QueuedDeclaration | Oui | Runs on the module's own serial background thread, in call order. |
sync — signatures de méthode
Signatures
<F extends SyncFunction>(): Synchronous<F>Paramètres de type
| Nom | Contrainte | Par défaut |
|---|---|---|
F | SyncFunction | — |
Paramètres
Aucun paramètre.
Retourne
Synchronous<F>
main — signatures de méthode
Signatures
<F extends AsyncFunction>(): FParamètres de type
| Nom | Contrainte | Par défaut |
|---|---|---|
F | AsyncFunction | — |
Paramètres
Aucun paramètre.
Retourne
F
background — signatures de méthode
Signatures
<F extends AsyncFunction>(): FParamètres de type
| Nom | Contrainte | Par défaut |
|---|---|---|
F | AsyncFunction | — |
Paramètres
Aucun paramètre.
Retourne
F
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.