Thank you for the quick response! I think I understand the problem and will
try your suggested approach.
On Tuesday, August 15, 2017 at 6:01:58 PM UTC-4, Matthias Bussonnier wrote:
>
> Hi,
>
> I think that the reason why yo do not get your event trigerd is that
> you haven't told `require` that IPython.events needs to be defined
> before you are called. You need to use something along the lines of
> teh following
>
>
> define(['base/js/namespace'], function(IPython){
> // your code, will be run only once base/js/namespace is loaded and
> with IPython == value return by base/js/namespace executed.
> // ...
> })
>
>
> It's far from being easy to understand how these things work, but that
> should put you on the right track.
> --
> M
>
> On Tue, Aug 15, 2017 at 2:57 PM, Sudarshan Raghunathan
> <[email protected] <javascript:>> wrote:
> > Apologies if this is a Javascript noob question. I have a kernel.js for
> my
> > custom kernel that looks like this:
> >
> > define(function(){
> >
> > var onload = function(){
> > console.log("I am being loaded")
> >
> > $([IPython.events]).on('status_started.Kernel', function() {
> > console.log("status_started.Kernel")
> > });
> >
> > $([IPython.events]).on('create.Cell', function() {
> > console.log("create.Cell")
> > });
> > }
> >
> > return {onload:onload}
> > })
> >
> >
> > I got the list of Javascript events from this page:
> >
> https://jupyter.readthedocs.io/en/latest/development_guide/js_events.html
> >
> > When my kernel starts, I can see that onload is being called but none of
> the
> > other event handlers seem to be getting triggered for example, when I
> add a
> > new cell to the notebook.
> >
> > Is kernel.js the correct place to register event handlers and if so, is
> > there anything I am doing obviously wrong like using obsolete names for
> the
> > events?
> >
> > Thank you in advance,
> > Sudarshan
> >
> > --
> > 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] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/jupyter/44d801c6-02fe-48c9-8175-a02eb3dd669f%40googlegroups.com.
>
>
> > 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/a0704e50-2fb0-4700-a4bc-51d33570ca23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.