MCPcopy
hub / github.com/pyodide/pyodide / bind

Method bind

src/core/pyproxy.ts:2877–2895  ·  view source on GitHub ↗

* The ``bind()`` method creates a new function that, when called, has its * ``this`` keyword set to the provided value, with a given sequence of * arguments preceding any provided when the new function is called. See * :js:meth:`Function.bind`. * * If the :js:class:`~pyodide.ffi.PyCal

(thisArg: any, ...jsargs: any)

Source from the content-addressed store, hash-verified

2875 * @returns
2876 */
2877 bind(thisArg: any, ...jsargs: any) {
2878 let { shared, props } = _getAttrs(this);
2879 const { boundArgs: boundArgsOld, boundThis: boundThisOld, isBound } = props;
2880 let boundThis = thisArg;
2881 if (isBound) {
2882 boundThis = boundThisOld;
2883 }
2884 let boundArgs = boundArgsOld.concat(jsargs);
2885 props = Object.assign({}, props, {
2886 boundArgs,
2887 isBound: true,
2888 boundThis,
2889 });
2890 return pyproxy_new(shared.ptr, {
2891 shared,
2892 flags: _getFlags(this),
2893 props,
2894 });
2895 }
2896
2897 /**
2898 * Returns a :js:class:`~pyodide.ffi.PyProxy` that passes ``this`` as the first argument to the

Callers 14

installer.tsFile · 0.80
dynload.tsFile · 0.80
loadPackageMethod · 0.80
load-package.tsFile · 0.80
setStdinFunction · 0.80
_setStdwriteFunction · 0.80
getFunction · 0.80
swapFuncFunction · 0.80
checkFunction · 0.80
tcp_serverFunction · 0.80
runFunction · 0.80

Calls 5

_getAttrsFunction · 0.85
pyproxy_newFunction · 0.85
_getFlagsFunction · 0.85
concatMethod · 0.80
assignMethod · 0.80

Tested by 5

checkFunction · 0.64
tcp_serverFunction · 0.64
runFunction · 0.64
tls_serverFunction · 0.64