TODO: think
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user