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/tests/testdata/jupyter/integration_test.ipynb | 51 ++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'cli/tests/testdata/jupyter/integration_test.ipynb') diff --git a/cli/tests/testdata/jupyter/integration_test.ipynb b/cli/tests/testdata/jupyter/integration_test.ipynb index e9347750d..1d48c8fc9 100644 --- a/cli/tests/testdata/jupyter/integration_test.ipynb +++ b/cli/tests/testdata/jupyter/integration_test.ipynb @@ -665,9 +665,58 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "8e93df23-06eb-414b-98d4-51fbebb53d1f", "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "Cannot read properties of undefined (reading 'broadcast')", + "output_type": "error", + "traceback": [ + "Stack trace:", + "TypeError: Cannot read properties of undefined (reading 'broadcast')", + " at :2:20" + ] + } + ], + "source": [ + "await Deno.jupyter.broadcast(\"display_data\", {\n", + " data: { \"text/html\": \"Processing.\" },\n", + " metadata: {},\n", + " transient: { display_id: \"progress\" }\n", + "});\n", + "\n", + "await new Promise((resolve) => setTimeout(resolve, 500));\n", + "\n", + "await Deno.jupyter.broadcast(\"update_display_data\", {\n", + " data: { \"text/html\": \"Processing..\" },\n", + " metadata: {},\n", + " transient: { display_id: \"progress\" }\n", + "});\n", + "\n", + "await new Promise((resolve) => setTimeout(resolve, 500));\n", + "\n", + "await Deno.jupyter.broadcast(\"update_display_data\", {\n", + " data: { \"text/html\": \"Processing...\" },\n", + " metadata: {},\n", + " transient: { display_id: \"progress\" }\n", + "});\n", + "\n", + "await new Promise((resolve) => setTimeout(resolve, 500));\n", + "\n", + "await Deno.jupyter.broadcast(\"update_display_data\", {\n", + " data: { \"text/html\": \"Complete ✅\" },\n", + " metadata: {},\n", + " transient: { display_id: \"progress\" }\n", + "});" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0181f28e", + "metadata": {}, "outputs": [], "source": [] } -- cgit v1.2.3