invoke method

JSValue invoke(
  1. int atom, {
  2. JSValue? thiz,
  3. int argc = 0,
  4. List<JSValue>? argv,
  5. bool autoDispose = true,
})

Implementation

JSValue invoke(
  int atom, {
  JSValue? thiz,
  int argc = 0,
  List<JSValue>? argv,
  bool autoDispose = true,
}) {
  argv ??= [];
  try {
    return JSValue.ptr(
      this,
      JS_Invoke(
        _ref,
        thiz?.ref.ref ?? JSValue.alloc(this, JSTag.NULL).ref.ref,
        atom,
        argc,
        argv.ref,
      ),
      autoDispose: autoDispose,
    );
  } finally {
    argv.free(group: argv.ref); // has dupValue
  }
}