NativeChannelApi
Defined in: sdk/src/services/nativeChannel.ts:30
What a script can ask of the app’s native code.
Properties
Section titled “Properties”available
Section titled “available”
readonlyavailable:boolean
Defined in: sdk/src/services/nativeChannel.ts:32
Whether this platform has native code to reach at all.
Methods
Section titled “Methods”call()
Section titled “call()”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.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”method
Section titled “method”string
unknown
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”method
Section titled “method”string
Returns
Section titled “Returns”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.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”string
handler
Section titled “handler”(data) => void
Returns
Section titled “Returns”() => void