callNatives method

void callNatives(
  1. CallNativeParams params
)

Implementation

void callNatives(CallNativeParams params) {
  if (_isDestroyed) {
    return;
  }

  final moduleInfo = _nativeModule[params._moduleName];
  if (moduleInfo == null) {
    var promise = JSPromise.js(
      _context,
      module: params._moduleName,
      method: params._moduleFunc,
      callId: params._callId,
    );
    // 这里跟hippy不一致,我们要主动暴露模块未找到的错误
    promise.error(
      JSPromise.kPromiseCodeOtherError,
      "module can not be found",
    );
    return;
  }

  _doCallNative(moduleInfo, params);
}