setInitialContext

fun setInitialContext(initialContext: Map<String, Any>)

Sets the initial context to pass to the web view.

Example usage (kotlin):

val map: Map<String, Any> = mapOf(
"foo" to "bar",
"ionic" to "portals"
"num" to 42
)

portal.setInitialContext(map)

Example usage (java):

Map<String, Object> map = Map.ofEntries(
new AbstractMap.SimpleEntry<String, @NotNull Object>("foo", "bar"),
new AbstractMap.SimpleEntry<String, @NotNull Object>("ionic", "portals"),
new AbstractMap.SimpleEntry<String, @NotNull Object>("num", 42)
);

portal.setInitialContext(map);

Parameters

initialContext

A map containing key/pair values that will be converted to a JavaScript object in the web view


fun setInitialContext(initialContext: String)

Sets the initial context to pass to the web view.

Example usage (kotlin):

portal.setInitialContext("{\"foo\": \"bar\"}")

Example usage (java):

portal.setInitialContext("{\"foo\": \"bar\"}");

Parameters

initialContext

a JSON string that will be converted to a JavaScript object in the web view