File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/quickjs-emscripten-core/src Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1074,6 +1074,25 @@ export class QuickJSContext
1074
1074
return this . success ( this . memory . heapValueHandle ( resultPtr ) )
1075
1075
}
1076
1076
1077
+ /**
1078
+ * `handle[key](...args)`
1079
+ *
1080
+ * Call a method on a JSValue. This is a convenience method that calls {@link getProp} and {@link callFunction}.
1081
+ *
1082
+ * @returns A result. If the function threw synchronously, `result.error` be a
1083
+ * handle to the exception. Otherwise `result.value` will be a handle to the
1084
+ * value.
1085
+ */
1086
+ callMethod (
1087
+ thisHandle : QuickJSHandle ,
1088
+ key : QuickJSPropertyKey ,
1089
+ args : QuickJSHandle [ ] = [ ] ,
1090
+ ) : ContextResult < QuickJSHandle > {
1091
+ return this . getProp ( thisHandle , key ) . consume ( ( func ) =>
1092
+ this . callFunction ( func , thisHandle , ...args ) ,
1093
+ )
1094
+ }
1095
+
1077
1096
/**
1078
1097
* Like [`eval(code)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#Description).
1079
1098
*
You can’t perform that action at this time.
0 commit comments