From ae0a1d3a54390743f457b9903566b7353bb2f3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 20 Dec 2019 19:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/jupyter.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js index 6610bfdca..1f64f7e77 100644 --- a/public/javascripts/jupyter.js +++ b/public/javascripts/jupyter.js @@ -9,7 +9,6 @@ window.onload=function(){ } function runEvery10Sec() { - // 1000 * 10 = 10 秒钟 console.log("每隔10秒中一次"); require(["base/js/namespace"],function(Jupyter) { @@ -26,24 +25,19 @@ $(function(){ document.addEventListener('keydown', (e) => { if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ e.preventDefault(); - console.log("点击了ctrl+s"); - console.log("开始发送消息了ctrl+s"); + console.log("ctrl+s"); window.parent.postMessage('jupytermessage','*'); } }); -}) -$(function(){ window.addEventListener('message', (e) => { - console.log("触发了Parentwindow"); - console.log(e); if(e){ if(e.data){ - if(e.data==="Parentwindow"){ + if(e.data==="stopParent"){ //重置停止 timebool=false; - console.log("父窗口调我了重置停止"); - }else if(e.data==="cancelwindow"){ - console.log("父窗口调我了取消启动"); + console.log("父窗口调用停止"); + }else if(e.data==="clonsParent"){ + console.log("父窗口调用启动"); //取消启动 timebool=true; this.runEvery10Sec(); @@ -51,7 +45,7 @@ $(function(){ } } - }); }) +