add edge addon publish scripts
This commit is contained in:
1 parent
5c3f15c70e
commit
5dba81e4a4
27 files changed
+889
-792
No files matched your search
@@ -1,52 +1,52 @@
|
||||
// function injectedFunction(color) {
|
||||
// document.body.style.backgroundColor = color;
|
||||
// }
|
||||
|
||||
|
||||
// chrome.runtime.onMessage.addListener(async ({ name, options }) => {
|
||||
// if (name === 'addRecord') {
|
||||
// console.log('Hello World!');
|
||||
|
||||
// // get active tab
|
||||
// // const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
// // chrome.scripting.executeScript({
|
||||
// // target: { tabId: tab.id },
|
||||
// // func: injectedFunction,
|
||||
// // args: ["orange"],
|
||||
// // });
|
||||
|
||||
// const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
// const response = await chrome.tabs.sendMessage(tab.id, { greeting: "hello" });
|
||||
// // do something with response here, not outside the function
|
||||
// console.log(response);
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
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);
|
||||
|
||||
// Send the message content.
|
||||
port.postMessage(messageBytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sendMessage('message 1');
|
||||
sendMessage('message 2');
|
||||
sendMessage('message 3');
|
||||
// function injectedFunction(color) {
|
||||
// document.body.style.backgroundColor = color;
|
||||
// }
|
||||
|
||||
|
||||
// chrome.runtime.onMessage.addListener(async ({ name, options }) => {
|
||||
// if (name === 'addRecord') {
|
||||
// console.log('Hello World!');
|
||||
|
||||
// // get active tab
|
||||
// // const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
// // chrome.scripting.executeScript({
|
||||
// // target: { tabId: tab.id },
|
||||
// // func: injectedFunction,
|
||||
// // args: ["orange"],
|
||||
// // });
|
||||
|
||||
// const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
// const response = await chrome.tabs.sendMessage(tab.id, { greeting: "hello" });
|
||||
// // do something with response here, not outside the function
|
||||
// console.log(response);
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
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);
|
||||
|
||||
// Send the message content.
|
||||
port.postMessage(messageBytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sendMessage('message 1');
|
||||
sendMessage('message 2');
|
||||
sendMessage('message 3');
|
||||
Reference in new issue
Block a user