registerWebMessageHandler

Registers a JavaScript bridge message handler for packets whose packet type matches type.

On first use this installs the bridge post-message bootstrap script into the document-start hook list and evaluates it in the current page, then delegates to JavaScriptBridge.registerWebMessageHandler to receive raw WebView messages. Incoming messages that cannot be decoded as JSPacket or whose packet type differs from type are ignored.

The returned CloseHandle unregisters the underlying raw WebView message handler.

Parameters

type

application-level packet type to accept.

handle

callback invoked with the decoded packet payload values.