summaryrefslogtreecommitdiff
path: root/cli/js/globals.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/globals.ts')
-rw-r--r--cli/js/globals.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/js/globals.ts b/cli/js/globals.ts
index 87ff13b22..e5b7ff85a 100644
--- a/cli/js/globals.ts
+++ b/cli/js/globals.ts
@@ -2,6 +2,7 @@
import * as blob from "./web/blob.ts";
import * as consoleTypes from "./web/console.ts";
+import * as promiseTypes from "./web/promise.ts";
import * as customEvent from "./web/custom_event.ts";
import * as domTypes from "./web/dom_types.ts";
import * as domFile from "./web/dom_file.ts";
@@ -102,6 +103,18 @@ declare global {
formatError: (e: Error) => string;
+ /**
+ * Get promise details as two elements array.
+ *
+ * First element is the `PromiseState`.
+ * If promise isn't pending, second element would be the result of the promise.
+ * Otherwise, second element would be undefined.
+ *
+ * Throws `TypeError` if argument isn't a promise
+ *
+ */
+ getPromiseDetails<T>(promise: Promise<T>): promiseTypes.PromiseDetails<T>;
+
decode(bytes: Uint8Array): string;
encode(text: string): Uint8Array;
}