-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
31 lines (29 loc) · 965 Bytes
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
chrome.runtime.onInstalled.addListener(async () => {
var hotkey = {
kctrl: true,
kshift: true,
kalt: false,
ktext: 'S'
}
chrome.storage.sync.set({ 'key': hotkey }, function() {
});
});
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete') {
}
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log("mative msg", request.message)
if (request.action === 'sendToNative') {
console.log("sdfsdf")
var hostName = "com.blue.chrome.load.host";
var port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener((message) => {
console.log(message);
});
port.onDisconnect.addListener(() => {
console.log('Disconnected from native app');
});
port.postMessage(request.message);
}
});