mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
Improved Promise polyfill for MicroPython only (#1517)
This commit is contained in:
committed by
GitHub
parent
50b1a1d7c5
commit
818614b798
@@ -1,21 +1,7 @@
|
||||
import { getBuffer } from "../fetch-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 */
|
||||
import { getBuffer } from "../fetch-utils.js";
|
||||
import { absoluteURL } from "../utils.js";
|
||||
|
||||
/**
|
||||
* Trim code only if it's a single line that prettier or other tools might have modified.
|
||||
|
||||
Reference in New Issue
Block a user