callAsFunction method

JSValue callAsFunction({
  1. JSObject? thisObject,
  2. List<JSValue>? arguments,
})

Implementation

JSValue callAsFunction({JSObject? thisObject, List<JSValue>? arguments}) {
  final JSException exception = JSException.create(_context);
  try {
    final JSValueRef valueRef = js_bd.JSObjectCallAsFunction(_context.ref, _ref, thisObject?.ref ?? nullptr, arguments?.length ?? 0, arguments?.ref ?? nullptr, exception.ref);
    if (exception.shouldThrow) {
      throw exception.error;
    }
    return JSValue(_context, valueRef);
  } finally {
    exception.release();
  }
}