aboutsummaryrefslogtreecommitdiff
path: root/src/preload.ts
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2020-12-22 18:39:20 +0530
committerPriyansh <[email protected]>2020-12-22 18:39:20 +0530
commitfb873ec2c3cb71cd478e6d48b424ddbba67cab0a (patch)
tree29e763f84d54d24152a212ec19cdfad2d56235b5 /src/preload.ts
parent6593dc005ae8d8f94e7c6644e3af4026e57cd2bf (diff)
downloadstyx-fb873ec2c3cb71cd478e6d48b424ddbba67cab0a.tar.xz
styx-fb873ec2c3cb71cd478e6d48b424ddbba67cab0a.zip
App rewrite using typescript
Diffstat (limited to 'src/preload.ts')
-rw-r--r--src/preload.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/preload.ts b/src/preload.ts
new file mode 100644
index 0000000..30290eb
--- /dev/null
+++ b/src/preload.ts
@@ -0,0 +1,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]);
+ }
+});