mirror of
https://github.com/pyscript/pyscript.git
synced 2026-03-27 11:00:44 -04:00
Improved Promise polyfill for MicroPython only (#1517)
This commit is contained in:
committed by
GitHub
parent
50b1a1d7c5
commit
818614b798
@@ -10,12 +10,19 @@ import {
|
||||
|
||||
const type = "micropython";
|
||||
|
||||
let patchPromise = true;
|
||||
|
||||
// REQUIRES INTEGRATION TEST
|
||||
/* c8 ignore start */
|
||||
export default {
|
||||
type: [type, "mpy"],
|
||||
module: () => `http://localhost:8080/micropython/micropython.mjs`,
|
||||
async engine({ loadMicroPython }, config, url) {
|
||||
// @bug https://github.com/micropython/micropython/issues/11749
|
||||
if (patchPromise) {
|
||||
patchPromise = false;
|
||||
globalThis.Promise = class extends Promise {};
|
||||
}
|
||||
const { stderr, stdout, get } = stdio();
|
||||
url = url.replace(/\.m?js$/, ".wasm");
|
||||
const runtime = await get(loadMicroPython({ stderr, stdout, url }));
|
||||
|
||||
Reference in New Issue
Block a user