summaryrefslogtreecommitdiff
path: root/cli/js/globals.ts
diff options
context:
space:
mode:
authorMichaƂ Sabiniarz <31597105+mhvsa@users.noreply.github.com>2020-03-31 01:01:19 +0200
committerGitHub <noreply@github.com>2020-03-30 19:01:19 -0400
commit30fdf6dc83d3a9d44436528959c39d3eab14cbbb (patch)
tree8f9cd11b1ae96333158b7a4be7d3d982dfde1688 /cli/js/globals.ts
parent3892d49165f00b2ce078825c204ba8ceaa21f386 (diff)
console: print promise details (#4524)
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;
}