From e9cda54cb827096ba8e24b2f951b96cdb3ecebf7 Mon Sep 17 00:00:00 2001 From: eson Date: Tue, 17 Nov 2020 19:59:44 +0800 Subject: [PATCH] =?UTF-8?q?TODO:=20=E8=A7=A3=E5=86=B3sendResponse=20?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=BC=82=E6=AD=A5=E7=AD=89=E5=BE=85=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98.=20=E5=AF=BC=E8=87=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=B0=B1=E5=AE=8C=E6=88=90=E4=BA=86=E4=B8=80=E4=B8=AA=E4=BA=A4?= =?UTF-8?q?=E4=BA=92.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- myblock/background/worker.js | 2 +- myblock/content/inject.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/myblock/background/worker.js b/myblock/background/worker.js index 791dda7..a0ce0ac 100644 --- a/myblock/background/worker.js +++ b/myblock/background/worker.js @@ -19,7 +19,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { case BackgroundMsgType.ERROR: console.log(request, task_manager, sender); // 利用sender tab id 返回正确的任务id case BackgroundMsgType.GETTASK: - // sendResponse({type: "error"}) + console.log(request, task_manager, sender); // 利用sender tab id 返回正确的任务id } // sendResponse({type: MsgType.NEWURL, url: "https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser"}); GetTask(sender); diff --git a/myblock/content/inject.js b/myblock/content/inject.js index 8a2c5d6..ceadccf 100644 --- a/myblock/content/inject.js +++ b/myblock/content/inject.js @@ -19,14 +19,14 @@ function SendContent() { function GetTask() { chrome.runtime.sendMessage({ type: BackgroundMsgType.GETTASK }, function (response) { switch(response.type) { - case BackgroundMsgType.FETCH: - setTimeout(function(){ - GetTask(); - }, 6000) - case BackgroundMsgType.WAIT: + case InjectMsgType.WAIT: setTimeout(function(){ GetTask(); }, 1000); + default: + setTimeout(function(){ + GetTask(); + }, 6000) } }) }