From 46a4bd5178f5aed22041422c431b5ab6f697865d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 27 Sep 2023 02:21:06 +0200 Subject: feat(unstable): add `Deno.jupyter.broadcast` API (#20656) Closes https://github.com/denoland/deno/issues/20591 --------- Co-authored-by: Kyle Kelley --- cli/tsc/dts/lib.deno.unstable.d.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'cli/tsc/dts/lib.deno.unstable.d.ts') diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index c8b857dc6..9f9a4914b 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -1947,6 +1947,39 @@ declare namespace Deno { */ shutdown(): Promise; } + + /** + * A namespace containing runtime APIs available in Jupyter notebooks. + * + * When accessed outside of Jupyter notebook context an error will be thrown. + * + * @category Jupyter */ + export namespace jupyter { + /** + * Broadcast a message on IO pub channel. + * + * ``` + * await Deno.jupyter.broadcast("display_data", { + * data: { "text/html": "Processing." }, + * metadata: {}, + * transient: { display_id: "progress" } + * }); + * + * await new Promise((resolve) => setTimeout(resolve, 500)); + * + * await Deno.jupyter.broadcast("update_display_data", { + * data: { "text/html": "Processing.." }, + * metadata: {}, + * transient: { display_id: "progress" } + * }); + * ``` + * + * @category Jupyter */ + export function broadcast( + msgType: string, + content: Record, + ): Promise; + } } /** **UNSTABLE**: New API, yet to be vetted. -- cgit v1.2.3