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

Function asyncTask

core/src/plugins/donkey.js:96–108  ·  view source on GitHub ↗
(method)

Source from the content-addressed store, hash-verified

94 farmer = await utils(options);
95 };
96 const asyncTask = (method) => async (code) => {
97 // race condition ... a new task has been
98 // assigned while the previous one didn't finish
99 if (working) await reload();
100 working = true;
101 try {
102 return await farmer[method](dedent(code));
103 } catch (e) {
104 console.error(e);
105 } finally {
106 working = false;
107 }
108 };
109 const asyncMethod = (method) => async () => {
110 if (working) await reload();
111 else farmer?.terminal[method]();

Callers 1

donkey.jsFile · 0.85

Calls 2

reloadFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected