TODO: think

This commit is contained in:
2021-04-27 18:36:08 +08:00
parent a7f0eabbc7
commit 6d1b058de8
10 changed files with 214 additions and 49 deletions

View File

@@ -1,14 +1,43 @@
// var href = window.location.href;
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)
// 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(){