if( window.location.href === "http://localhost:12203/start") { var ws = new WebSocket("ws://localhost:12203/task"); ws.onopen = function(evt) { console.log("Connection open ...", evt); ws.send("Hello WebSockets!"); }; ws.onmessage = function(evt) { console.log("Received Message: ", JSON.parse(evt.data)); // if (window.location.hostname !== "www.zhipin.com") { // var handler = window.open("https://www.zhipin.com/") // } chrome.runtime.sendMessage(JSON.parse(evt.data)) }; ws.onclose = function(evt) { console.log("Connection closed."); }; ws.onerror = function(evt) { console.log(evt); } } // setInterval(function name() { // chrome.runtime.sendMessage({say: "Hello"}) // fetch("http://localhost:12203/api").then((response)=>{ // console.log(response); // console.log(response.json()) // }) // }, 10000) // 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); // } // };