HI Adam,
The seal() was added to avoid mistyped property that at some point was hard
to track on the codebase. It is not possible to unseal an object
unfortunately.
Assigning to Jupyter.sidebar should be ok, the context is not shared
between tabs or windows, and Jupyter.notebook mostly refer to the the
current notebook frontend application more than the actual document.
IIRC Jupyter should also be accessible if you
require('base/js/namespace',...), or alternatively you can attach your
element to `window` I guess.
More generally, I _believe_ (but I may be wrong) that if you are using
define/require, I believe modules are singleton so requiring the same path
or library return you the sam instance. So it might work without having to
attach sidebar to any global variable. A bit like you would attach
something to numpy, or matplotlib.
The extension looks really cool in the gif !
--
M
On 9 January 2018 at 20:33, Adam Rule <[email protected]> wrote:
> I am creating a Jupyter Notebook extension
> <https://github.com/acrule/janus> for research purposes that creates a
> sidebar where users can "hide" cells with implementation details until they
> wish to see them. I am doing something similar to Min's old Scratchpad
> <https://github.com/minrk/nbextension-scratchpad> extension by creating a
> persistent Sidebar element for rendering these "hidden" cells on demand.
>
> I was attempting to assign my Sidebar element to Jupyter.notebook.sidebar
> so I can reference it later, but it seems Jupyter.notebook is sealed
> <https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/notebook.js#L252>
> so
> I cannot add new properties. Is there a way for me to get around this or is
> the sealing permanent? For now I am assigning the Sidebar element to
> Jupyter.notebook.session.sidebar but am not sure if code manipulating the
> notebook session may delete this reference. Alternatively I tried assigning
> it to Jupyter.sidebar, but think this will cause problems if a user has
> multiple notebooks open.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/e7365c65-ddd5-4720-844e-275778a8ab31%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/e7365c65-ddd5-4720-844e-275778a8ab31%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/CANJQusWJcQVhgaAeYvqtk1MP69AOSTK9UZK2hy1F1h5VfPW-NQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.