summaryrefslogtreecommitdiff
path: root/runtime/js/99_main.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-09-28 16:51:44 +0200
committerGitHub <noreply@github.com>2023-09-28 16:51:44 +0200
commit0bd53fd52d8937afed401fe1c61bb2ba0b23501c (patch)
tree4bba498372accf7fc0a3d2fca7ea3f99329f8f1f /runtime/js/99_main.js
parent35fad4d2bc022b7053b5390ec1fb47ca28f4086e (diff)
fix(jupyter): more robust Deno.jupyter namespace (#20710)
Diffstat (limited to 'runtime/js/99_main.js')
-rw-r--r--runtime/js/99_main.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 15e4936b1..d2a28838a 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -545,12 +545,19 @@ function bootstrapMainRuntime(runtimeOptions) {
// TODO(bartlomieju): this is not ideal, but because we use `ObjectAssign`
// above any properties that are defined elsewhere using `Object.defineProperty`
// are lost.
+ let jupyterNs = undefined;
ObjectDefineProperty(finalDenoNs, "jupyter", {
get() {
+ if (jupyterNs) {
+ return jupyterNs;
+ }
throw new Error(
"Deno.jupyter is only available in `deno jupyter` subcommand.",
);
},
+ set(val) {
+ jupyterNs = val;
+ },
});
}