forked from NachiketGadekar1/browserllama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.js
23 lines (20 loc) · 963 Bytes
/
home.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// message for connecting with native host will be sent to background.js when connect is pressed
document.addEventListener('DOMContentLoaded', () => {
const connectButton = document.getElementById('connect-button');
if (connectButton) {
connectButton.addEventListener('click', () => {
chrome.runtime.sendMessage({action: "connect"}, function(response) {
if (chrome.runtime.lastError) {
console.error("Error connecting:", chrome.runtime.lastError);
} else {
console.log("Connect response:", response);
localStorage.setItem('runConnectLogic', 'true');
window.location.href = 'main.html';
}
});
// Set a flag in localStorage
localStorage.setItem('runConnectLogic', 'true');
window.location.href = 'main.html';
});
}
});