From 30fdf6dc83d3a9d44436528959c39d3eab14cbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sabiniarz?= <31597105+mhvsa@users.noreply.github.com> Date: Tue, 31 Mar 2020 01:01:19 +0200 Subject: console: print promise details (#4524) --- cli/js/globals.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cli/js/globals.ts') 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(promise: Promise): promiseTypes.PromiseDetails; + decode(bytes: Uint8Array): string; encode(text: string): Uint8Array; } -- cgit v1.2.3