mirror of
https://github.com/yaklang/yaklang-chrome-extension.git
synced 2026-09-25 20:51:52 +08:00
14 lines
449 B
JavaScript
14 lines
449 B
JavaScript
document.getElementById('connectBtn').addEventListener('click', () => {
|
|
let wsUrl = document.getElementById('wsUrl').value;
|
|
if (!wsUrl) {
|
|
wsUrl = 'ws://127.0.0.1:8881/?token=a'
|
|
}
|
|
const msg = {
|
|
action: "connectWebsocket", url: wsUrl,
|
|
};
|
|
chrome.runtime.sendMessage(msg)
|
|
})
|
|
|
|
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
|
document.getElementById("wsStatus").innerText = msg.status;
|
|
}); |