废弃代码

This commit is contained in:
xxq250 2023-10-18 11:34:44 +08:00
parent 482578ced7
commit af033bb8d0
1 changed files with 49 additions and 49 deletions

View File

@ -1,51 +1,51 @@
//用于嵌入到jupyter pod中的js
//guange 2019.12.18
var timebool=false;
window.onload=function(){
console.log("开始发送消息了");
timebool=true;
// runEvery10Sec();
}
function runEvery10Sec() {
// 1000 * 10 = 10 秒钟
// console.log("每隔10秒中一次");
require(["base/js/namespace"],function(Jupyter) {
Jupyter.notebook.save_checkpoint();
});
window.parent.postMessage('jupytermessage','*');
// if(timebool===true){
// setTimeout( runEvery10Sec, 1000 * 10 );
// }
}
window.onload=function(){
document.addEventListener('keydown', (e) => {
if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){
e.preventDefault();
console.log("ctrl+s");
window.parent.postMessage('jupytermessage','*');
}
});
window.addEventListener('message', (e) => {
if(e){
if(e.data){
if(e.data==="stopParent"){
//重置停止
timebool=false;
// console.log("父窗口调用停止");
}else if(e.data==="clonsParent"){
// console.log("父窗口调用启动");
//取消启动
timebool=true;
// runEvery10Sec();
}
}
}
});
}
//
// var timebool=false;
// window.onload=function(){
// console.log("开始发送消息了");
// timebool=true;
// // runEvery10Sec();
// }
//
// function runEvery10Sec() {
// // 1000 * 10 = 10 秒钟
// // console.log("每隔10秒中一次");
// require(["base/js/namespace"],function(Jupyter) {
// Jupyter.notebook.save_checkpoint();
// });
// window.parent.postMessage('jupytermessage','*');
// // if(timebool===true){
// // setTimeout( runEvery10Sec, 1000 * 10 );
// // }
//
// }
//
// window.onload=function(){
//
// document.addEventListener('keydown', (e) => {
// if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){
// e.preventDefault();
// console.log("ctrl+s");
// window.parent.postMessage('jupytermessage','*');
// }
// });
//
// window.addEventListener('message', (e) => {
// if(e){
// if(e.data){
// if(e.data==="stopParent"){
// //重置停止
// timebool=false;
// // console.log("父窗口调用停止");
// }else if(e.data==="clonsParent"){
// // console.log("父窗口调用启动");
// //取消启动
// timebool=true;
// // runEvery10Sec();
// }
// }
//
// }
// });
// }