MCPcopy Index your code
hub / github.com/pyscript/pyscript / value

Function value

core/src/plugins/py-editor.js:394–407  ·  view source on GitHub ↗

* Simulate a setup node overriding the source to evaluate. * @param {string} code the Python code to evaluate. * @param {boolean} asRunButtonAction invoke the `Run` button handler. * @returns {Promise<...>} fulfill once code has been evaluated.

(code, asRunButtonAction = false)

Source from the content-addressed store, hash-verified

392 * @returns {Promise<...>} fulfill once code has been evaluated.
393 */
394 value(code, asRunButtonAction = false) {
395 if (asRunButtonAction) return listener();
396 const wasSetup = isSetup;
397 const wasSource = source;
398 isSetup = true;
399 source = code;
400 const restore = () => {
401 isSetup = wasSetup;
402 source = wasSource;
403 };
404 return context
405 .handleEvent({ currentTarget: null })
406 .then(restore, restore);
407 },
408 },
409 });
410

Callers 1

config.jsFile · 0.85

Calls 1

listenerFunction · 0.70

Tested by

no test coverage detected