add basic dev boostrap

This commit is contained in:
VillanCh
2024-03-21 09:23:52 +08:00
parent acb8307c98
commit 96141b9d30
6 changed files with 257 additions and 19 deletions
+27
View File
@@ -0,0 +1,27 @@
import {chrome} from "./chromeapi";
export namespace wsc {
export function connect(port: number, host?: string) {
chrome.runtime.sendMessage({
action: 'connect',
host: host || '127.0.0.1',
port: port,
});
}
export function disconnect() {
chrome.runtime.sendMessage({
action: 'disconnect',
});
}
export function getStatus() {
chrome.runtime.sendMessage({
action: 'status',
});
}
export function listen(onMessage: (message: any) => void) {
chrome.runtime.onMessage.addListener(onMessage);
}
}