MCPcopy Index your code
hub / github.com/pyodide/pyodide / apply

Method apply

src/core/pyproxy.ts:2686–2694  ·  view source on GitHub ↗

* The ``apply()`` method calls the specified function with a given this * value, and arguments provided as an array (or an array-like object). Like * :js:meth:`Function.apply`. * * @param thisArg The ``this`` argument. Has no effect unless the * :js:class:`~pyodide.ffi.PyCallable` has

(thisArg: any, jsargs: any)

Source from the content-addressed store, hash-verified

2684 * @returns The result from the function call.
2685 */
2686 apply(thisArg: any, jsargs: any) {
2687 // Convert jsargs to an array using ordinary .apply in order to match the
2688 // behavior of .apply very accurately.
2689 jsargs = function (...args: any) {
2690 return args;
2691 }.apply(undefined, jsargs);
2692 jsargs = _adjustArgs(this, thisArg, jsargs);
2693 return Module.callPyObject(_getPtr(this), jsargs);
2694 }
2695 /**
2696 * Calls the function with a given this value and arguments provided
2697 * individually. See :js:meth:`Function.call`.

Callers 10

initializeNativeFSFunction · 0.80
applyFunction · 0.80
createContextWrapperFunction · 0.80
getFunction · 0.80
reduceMethod · 0.80
reduceRightMethod · 0.80
concatMethod · 0.80
copyWithinMethod · 0.80
fillMethod · 0.80
applyFunction · 0.80

Calls 2

_adjustArgsFunction · 0.85
_getPtrFunction · 0.85

Tested by

no test coverage detected