mirror of
https://github.com/denoland/deno.git
synced 2025-08-31 07:47:46 +00:00
fix(jupyter): more robust Deno.jupyter namespace (#20710)
This commit is contained in:
parent
35fad4d2bc
commit
0bd53fd52d
4 changed files with 82 additions and 63 deletions
|
@ -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;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue