-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
preload.tsx
21 lines (17 loc) · 671 Bytes
/
preload.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
import React = require("react");
import ReactDOM = require("react-dom");
import { Charta } from "./react-engine/Charta";
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 as any)[type]);
}
ReactDOM.render(<Charta/>, document.getElementById("idReactMain"));
});