调整jupyte

chromesetting
杨树林 5 years ago
parent 31b8fdfde1
commit a5bcad43d4

@ -1,20 +1,25 @@
//用于嵌入到jupyter pod中的js //用于嵌入到jupyter pod中的js
//guange 2019.12.18 //guange 2019.12.18
var timebool=false;
window.onload=function(){ window.onload=function(){
console.log("开始发送消息了"); console.log("开始发送消息了");
timebool=true;
runEvery10Sec(); runEvery10Sec();
} }
function runEvery10Sec() { function runEvery10Sec() {
// 1000 * 10 = 10 秒钟 // 1000 * 10 = 10 秒钟
console.log("每隔10秒中一次"); console.log("每隔10秒中一次");
require(["base/js/namespace"],function(Jupyter) { require(["base/js/namespace"],function(Jupyter) {
Jupyter.notebook.save_checkpoint(); Jupyter.notebook.save_checkpoint();
}); });
window.parent.postMessage('jupytermessage','*'); window.parent.postMessage('jupytermessage','*');
setTimeout( runEvery10Sec, 1000 * 10 ); if(timebool===true){
setTimeout( runEvery10Sec, 1000 * 10 );
}
} }
$(function(){ $(function(){
@ -34,7 +39,14 @@ $(function(){
if(e){ if(e){
if(e.data){ if(e.data){
if(e.data==="Parentwindow"){ if(e.data==="Parentwindow"){
//重置停止
timebool=false;
console.log("父窗口调我了");
}else if(e.data==="Parentwindow"){
console.log("父窗口调我了"); console.log("父窗口调我了");
//取消启动
timebool=true;
this.runEvery10Sec();
} }
} }

Loading…
Cancel
Save