commit 3c286023d3ed9fac995b4a5149a31f10a15a4728
parent 46b6607b2af75fd6c2d3a44fbb265009dc9781b9
Author: Nullptrderef <nullptrderef@proton.me>
Date: Sun, 11 Aug 2024 19:27:41 +0200
fix: provide native {create,revoke}ObjectURL implementation aliases
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/packages/taler-util/src/whatwg-url.ts b/packages/taler-util/src/whatwg-url.ts
@@ -425,7 +425,7 @@ export class URLSearchParamsImpl {
}
entries() {
- return [...this._list.map(x => [x[0], x[1]])];
+ return [...this._list.map((x) => [x[0], x[1]])];
}
forEach(
@@ -1911,6 +1911,7 @@ function parseURL(
});
}
+const NativeURL = typeof URL !== "undefined" ? URL : undefined;
export class URLImpl {
//Include URL type for "url" and "base" params.
constructor(url: string | URL, base?: string | URL) {
@@ -2124,6 +2125,21 @@ export class URLImpl {
return this.href;
}
+ static createObjectURL(blob: Blob) {
+ if (!NativeURL)
+ throw new Error(
+ "This method requires a native implementation, which does not exist",
+ );
+ return NativeURL.createObjectURL(blob);
+ }
+ static revokeObjectURL(url: string) {
+ if (!NativeURL)
+ throw new Error(
+ "This method requires a native implementation, which does not exist",
+ );
+ return NativeURL.revokeObjectURL(url);
+ }
+
// FIXME: type!
_url: any;
_query: any;