FunctionDeclarations
Declares, in a native module's spec, on which thread each of its functions runs.
Utilização
Connect a reporting service
Este tipo é usado por 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' },
});Declaração do tipo
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;
}Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
sync | <F extends SyncFunction>() => Synchronous<F> | Sim | Runs on the JS thread and returns its value. Keep it fast, thread-safe and off UIKit and Views. |
main | QueuedDeclaration | Sim | Runs on the main (UI) thread. |
background | QueuedDeclaration | Sim | Runs on the module's own serial background thread, in call order. |
sync — assinaturas de método
Assinaturas
<F extends SyncFunction>(): Synchronous<F>Parâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
F | SyncFunction | — |
Parâmetros
Sem parâmetros.
Devolve
Synchronous<F>
main — assinaturas de método
Assinaturas
<F extends AsyncFunction>(): FParâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
F | AsyncFunction | — |
Parâmetros
Sem parâmetros.
Devolve
F
background — assinaturas de método
Assinaturas
<F extends AsyncFunction>(): FParâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
F | AsyncFunction | — |
Parâmetros
Sem parâmetros.
Devolve
F
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.