QueuedDeclaration
Declares a native module function that runs on the main thread or the module's background thread, returning a value or settling through a callback.
Usage
Connect a reporting service
This type is used by 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' },
});Type declaration
export interface QueuedDeclaration {
/** Runs on its thread and returns its result; JavaScript gets a Promise of it. */
<F extends AsyncFunction>(): F;
/** Starts on its thread and settles a `KuitoPromise` once, from any thread: a callback API. */
callback<F extends AsyncFunction>(): F;
}Members 1
| Name | Type | Required | Description |
|---|---|---|---|
callback | <F extends AsyncFunction>() => F | Yes | Starts on its thread and settles a KuitoPromise once, from any thread: a callback API. |
callback — 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.