registerWebMessageHandlerWithReply

Registers a JavaScript bridge message handler for packets sent by window.wvbridge.postMessageAndReceiveResult(type, options).

The page-side API appends an internal reply token after options.args. This function removes that token before invoking handle and provides a reply callback that calls the generated window.__wvbridge__[uuid] function in the page.

Calling reply after the JavaScript-side timeout is harmless from Kotlin's perspective, but the page may no longer have the generated function installed.

Parameters

type

application-level packet type to accept.

handle

callback invoked with decoded payload values and a reply callback.