mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
7bcf1211a1
Exposes [`metadata`](https://jupyter-client.readthedocs.io/en/latest/messaging.html#metadata) to the `Deno.jupyter.broadcast` API. ```js await Deno.jupyter.broadcast(msgType, content, metadata); ``` The metadata is required for [`"comm_open"`](https://github.com/jupyter-widgets/ipywidgets/blob/main/packages/schema/messages.md#instantiating-a-widget-object-1) for with `jupyter.widget` target.
18 lines
468 B
JavaScript
18 lines
468 B
JavaScript
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
|
|
const core = globalThis.Deno.core;
|
|
const internals = globalThis.__bootstrap.internals;
|
|
|
|
function enableJupyter() {
|
|
const {
|
|
op_jupyter_broadcast,
|
|
} = core.ensureFastOps();
|
|
|
|
globalThis.Deno.jupyter = {
|
|
async broadcast(msgType, content, { metadata = {} } = {}) {
|
|
await op_jupyter_broadcast(msgType, content, metadata);
|
|
},
|
|
};
|
|
}
|
|
|
|
internals.enableJupyter = enableJupyter;
|