diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-09-28 16:51:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 16:51:44 +0200 |
commit | 0bd53fd52d8937afed401fe1c61bb2ba0b23501c (patch) | |
tree | 4bba498372accf7fc0a3d2fca7ea3f99329f8f1f /runtime/js | |
parent | 35fad4d2bc022b7053b5390ec1fb47ca28f4086e (diff) |
fix(jupyter): more robust Deno.jupyter namespace (#20710)
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/99_main.js | 7 |
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; + }, }); } |