aboutsummaryrefslogtreecommitdiff
path: root/src/preload.ts
blob: 30290eb1e363498a4a5235e488080cfc63e601e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window.addEventListener("DOMContentLoaded", () => {
    const replaceText = (selector: string, text: string) => {
        const element = document.getElementById(selector);
        if (element) {
            element.innerText = text;
        }
    };

    for (const type of ["chrome", "node", "electron"]) {
        replaceText(`${type}-version`, process.versions[type as keyof NodeJS.ProcessVersions]);
    }
});