From 16d95d842b79831b67b057387d6f32c192860dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 20 Dec 2019 14:25:04 +0800 Subject: [PATCH 1/2] =?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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js index 7b2313139..50541f6e7 100644 --- a/public/javascripts/jupyter.js +++ b/public/javascripts/jupyter.js @@ -4,9 +4,18 @@ $(function(){ console.log("educoder jupyter js init"); + runEvery10Sec(); }) $(function(){ console.log("开始发送消息了"); window.parent.postMessage('jupytermessage','*'); + }) + +function runEvery10Sec() { + // 1000 * 10 = 10 秒钟 + console.log("每隔10秒中一次runEvery10Sec"); + setTimeout( runEvery10Sec, 1000 * 10 ); + +} From 4e803c511426cf1e1414dbb614039f176e1eb2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 20 Dec 2019 14:33:47 +0800 Subject: [PATCH 2/2] =?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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js index 50541f6e7..021d46a2e 100644 --- a/public/javascripts/jupyter.js +++ b/public/javascripts/jupyter.js @@ -2,20 +2,15 @@ //guange 2019.12.18 -$(function(){ - console.log("educoder jupyter js init"); - runEvery10Sec(); -}) - $(function(){ console.log("开始发送消息了"); - window.parent.postMessage('jupytermessage','*'); - + runEvery10Sec(); }) function runEvery10Sec() { // 1000 * 10 = 10 秒钟 console.log("每隔10秒中一次runEvery10Sec"); + window.parent.postMessage('jupytermessage','*'); setTimeout( runEvery10Sec, 1000 * 10 ); }