var href = window.location.href; if(href.startsWith(Host)) { setInterval(function(){ GetTask(); }, 1); } else { setTimeout(function(){ chrome.runtime.sendMessage({ type: BackgroundMsgType.CLOSETAB }) }, 15000) } function GetTask() { try { chrome.runtime.sendMessage({ type: BackgroundMsgType.GETTASK }, function(){}); } catch (error) { console.log(error); } };