Skip to content

NativeChannelApi

Defined in: sdk/src/services/nativeChannel.ts:30

What a script can ask of the app’s native code.

readonly available: boolean

Defined in: sdk/src/services/nativeChannel.ts:32

Whether this platform has native code to reach at all.

call<T>(method, args?): Promise<T>

Defined in: sdk/src/services/nativeChannel.ts:40

Call method in the app’s native code. Resolves with what it answered; rejects when nothing answers to the name, or with the reason the native side gave. args is anything JSON carries.

T = unknown

string

unknown

Promise<T>


has(method): boolean

Defined in: sdk/src/services/nativeChannel.ts:34

Whether a call to method would be answered. Cheap; ask before offering a feature.

string

boolean


on<T>(event, handler): () => void

Defined in: sdk/src/services/nativeChannel.ts:42

Hear every event the native side raises from now on. Returns the unsubscribe.

T = unknown

string

(data) => void

() => void