bind

public final Unit bind(String name, Function2<WebviewKo, String, String> fn)

Binds a native Kotlin/Java callback so that it will appear under the given name as a global JavaScript function.

Callback receives a request string. Request string is a JSON array of all the arguments passed to the JavaScript function.

Parameters

name

the name of the global JavaScript function

fn

the callback function which receives the request parameter in JSON as input and return the response to JS in JSON. In Java the fn should be String response(WebviewKo webview, String request)