Thanks for this basic suggestion. I've whipped something up that seems 
promising. Currently I have one big issue, though: how can I get the cell 
index for the js code that is executing?! This seems like it should be 
simple, but I have been struggling lol. I can get the index of the selected 
or focused cell, but that doesn't help much.

Here's a minimal example I'm working from:

%%javascript

var interval = 10;

// need replacement for THIS next line
// should return this cell's index
var idx  = 0;

var cell = IPython.notebook.get_cell(idx);
element.append(idx + ' ')

var time = new Date();
element.append(time.getSeconds());

setTimeout(function(){
    cell.execute();
}, interval * 1000);

any help much much appreciated. Once this works it seems straight forward 
to put it in a magic.

TJ



On Thursday, February 2, 2017 at 6:54:16 AM UTC-8, takowl wrote:
>
> On 2 February 2017 at 03:02, TJ Lane <[email protected] <javascript:>
> > wrote:
>
>> My current vision for this is to write a magic function, %rerun <time>. 
>> This would declare that the code in that cell should be re-run after a 
>> specified time, perhaps defaulting to 1 or 10 seconds. The notebook could 
>> block while the cell is being re-evaluated, but should not block while 
>> waiting.
>
>
> A quick and dirty way to implement this would be for the %rerun magic to 
> display some Javascript which will execute the cell again in the frontend 
> after a given delay.
>
> Anything cleverer that I can think may be troublesome, because the 
> notebook frontend won't be expecting output and may not handle it correctly.
>

-- 
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/eaebb752-14d1-420b-b5cc-3a4ed4a7bb7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to