addJavascriptChannels method

  1. @deprecated
Future<void> addJavascriptChannels(
  1. List<String> names,
  2. MessageReceived callback
)

直接使用X5WebView(javascriptChannels:JavascriptChannels(names, (name, data) { }))

Implementation

@deprecated
Future<void> addJavascriptChannels(
    List<String> names, MessageReceived callback) async {
  await _channel.invokeMethod("addJavascriptChannels", {'names': names});
  _channel.setMethodCallHandler((call) async {
    if (call.method == "onJavascriptChannelCallBack") {
      Map arg = call.arguments;
      callback(arg["name"], arg["msg"]);
    }
  });
}