Closed n-riesco closed 6 years ago
var d1 = $$.display("d1");
d1.text("1");
d1.text("2");
jupyter-notebook@4.2.3 final output is 1 jupyter-notebook@5.2.1 final output is 2
import os
from IPython.display import display
handle = display(0, display_id="counter")
for n in range(1, 10):
os.system("sleep 1")
handle.update(n)
ipython@5.1.0 thrown exception at handle.update(n)
ipython@5.5.0 works as expected
https://github.com/n-riesco/nel/commit/0322589c978a664bdffecdfe0a1f2f698afc02fc addresses this issue (needs testing with jupyter-notebook@4.2.3
and jupyter-notebook@5.2.1
).
https://github.com/n-riesco/nel/commit/0322589c978a664bdffecdfe0a1f2f698afc02fc tested on jupyter-notebook@5.2.1
using the example:
var counter = $$.display("counter");
var n = 0;
counter.text('' + n++);
(function($$) {
var stopCounter = (function() {
var id = setInterval(function() {
counter.text('' + n++);
}, 1000);
return function() {
console.log("done");
clearInterval(id);
}
})();
setTimeout(stopCounter, 10000);
})($$);
Note the following gotchas:
update_display_data
messagesdisplay_data
messages sent before the execution result$$.async()
and $$.done()
to ensure display_data
messages are sent after the execution result.counter.text(n++);
by counter.text('' + n++);
to ensure a string is sent