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/js/40_jupyter.js | 16 ++++++++++++++++ cli/js/99_main.js | 1 + 2 files changed, 17 insertions(+) create mode 100644 cli/js/40_jupyter.js (limited to 'cli/js') diff --git a/cli/js/40_jupyter.js b/cli/js/40_jupyter.js new file mode 100644 index 000000000..8cdf0789a --- /dev/null +++ b/cli/js/40_jupyter.js @@ -0,0 +1,16 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. + +const core = globalThis.Deno.core; +const internals = globalThis.__bootstrap.internals; + +import { denoNsUnstable } from "ext:runtime/90_deno_ns.js"; + +function enableJupyter() { + denoNsUnstable.jupyter = { + async broadcast(msgType, content) { + await core.opAsync("op_jupyter_broadcast", msgType, content); + }, + }; +} + +internals.enableJupyter = enableJupyter; diff --git a/cli/js/99_main.js b/cli/js/99_main.js index dc9d74fb0..37342f6cd 100644 --- a/cli/js/99_main.js +++ b/cli/js/99_main.js @@ -1,3 +1,4 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. import "ext:cli/40_testing.js"; +import "ext:cli/40_jupyter.js"; import "ext:cli/runtime/js/99_main.js"; -- cgit v1.2.3