1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2025-01-31 02:08:45 +00:00
code-server-2/packages/app/chrome/src/content.ts

34 lines
724 B
TypeScript
Raw Normal View History

import { create } from "@coder/app/common/src/app";
import { tcpHost } from "./chome";
create({
storage: {
get: <T>(key: string): Promise<T | undefined> => {
return new Promise<T | undefined>((resolve, reject): void => {
try {
chrome.storage.sync.get(key, (items) => {
resolve(items[key]);
});
} catch (ex) {
reject(ex);
}
});
},
set: <T>(key: string, value: T): Promise<void> => {
return new Promise<void>((resolve, reject): void => {
try {
chrome.storage.sync.set({
[key]: value,
}, () => {
resolve();
});
} catch (ex) {
reject(ex);
}
});
},
},
tcp: tcpHost,
node: document.getElementById("main") as HTMLDivElement,
});