mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 19:25:35 -05:00
Worker sync utility (#1511)
* patched an issue with wasmoon randomly asking to resolve proxy references * simplified pyodide and micropython dance by grouping their common utilities together * created an integration test around a worker to main thread input between MicroPython and Lua * commented some weird bugs / funny behaviors around both MicroPython and Pyodide * other minor clean ups
This commit is contained in:
committed by
GitHub
parent
0cdbfbeb30
commit
af72e232c3
@@ -1,10 +1,26 @@
|
||||
import { getBuffer } from "../fetch-utils.js";
|
||||
import { absoluteURL } from "../utils.js";
|
||||
import { absoluteURL, defineProperty } from "../utils.js";
|
||||
import "@ungap/with-resolvers";
|
||||
|
||||
// REQUIRES INTEGRATION TEST
|
||||
/* c8 ignore start */
|
||||
// TODO: this should *NOT* be needed as the polyfill
|
||||
// already patches on demand the Promise object
|
||||
const { withResolvers } = Promise;
|
||||
defineProperty(globalThis, "Promise", {
|
||||
configurable: true,
|
||||
value: class extends Promise {
|
||||
withResolvers() {
|
||||
return withResolvers.call(this);
|
||||
}
|
||||
},
|
||||
});
|
||||
/* c8 ignore stop */
|
||||
|
||||
/**
|
||||
* Trim code only if it's a single line that prettier or other tools might have modified.
|
||||
* @param {string} code code that might be a single line
|
||||
* @returns {strong}
|
||||
* @returns {string}
|
||||
*/
|
||||
export const clean = (code) =>
|
||||
code.replace(/^[^\r\n]+$/, (line) => line.trim());
|
||||
|
||||
Reference in New Issue
Block a user