add adblock content script
This commit is contained in:
1 parent
5dba81e4a4
commit
f245fb048b
8 files changed
+117
-102
No files matched your search
@@ -23,30 +23,30 @@
|
||||
// }
|
||||
// });
|
||||
|
||||
let port;
|
||||
// let port;
|
||||
|
||||
function sendMessage(message) {
|
||||
if (!port) {
|
||||
// this will run the first time to launch the native host, and save the connection to that instance in the port
|
||||
port = chrome.runtime.connectNative('com.woni.chrome.botext');
|
||||
}
|
||||
// Convert the message to a Uint8Array.
|
||||
var encoder = new TextEncoder();
|
||||
var messageBytes = encoder.encode(message);
|
||||
// Send the message length as a 32-bit integer.
|
||||
var buffer = new ArrayBuffer(4);
|
||||
var view = new DataView(buffer);
|
||||
view.setUint32(0, messageBytes.length, true);
|
||||
port.postMessage(buffer);
|
||||
// function sendMessage(message) {
|
||||
// if (!port) {
|
||||
// // this will run the first time to launch the native host, and save the connection to that instance in the port
|
||||
// port = chrome.runtime.connectNative('com.woni.chrome.botext');
|
||||
// }
|
||||
// // Convert the message to a Uint8Array.
|
||||
// var encoder = new TextEncoder();
|
||||
// var messageBytes = encoder.encode(message);
|
||||
// // Send the message length as a 32-bit integer.
|
||||
// var buffer = new ArrayBuffer(4);
|
||||
// var view = new DataView(buffer);
|
||||
// view.setUint32(0, messageBytes.length, true);
|
||||
// port.postMessage(buffer);
|
||||
|
||||
// Send the message content.
|
||||
port.postMessage(messageBytes);
|
||||
}
|
||||
// // Send the message content.
|
||||
// port.postMessage(messageBytes);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sendMessage('message 1');
|
||||
sendMessage('message 2');
|
||||
sendMessage('message 3');
|
||||
// sendMessage('message 1');
|
||||
// sendMessage('message 2');
|
||||
// sendMessage('message 3');
|
||||
Reference in new issue
Block a user