Added application settings and basic filewatcher.

This commit is contained in:
Patrick Fic
2020-10-13 12:59:43 -07:00
parent 36b3719df0
commit 6dddd4bdf0
10 changed files with 207 additions and 18 deletions

View File

@@ -2,7 +2,10 @@ import { Button, Layout } from "antd";
import React, { useEffect } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../ipc.types";
const { ipcRenderer } = window.require("electron");
const settings = window.require("electron-settings");
const mapStateToProps = createStructuredSelector({});
const mapDispatchToProps = (dispatch) => ({});
@@ -12,10 +15,15 @@ export function App() {
ipcRenderer.on("test-success", (event, obj) => {
console.log("Test Success", obj);
});
ipcRenderer.on(ipcTypes.default.filewatcher.startSuccess, (event, obj) => {
console.log(ipcTypes.default.filewatcher.startSuccess, obj);
});
// Cleanup the listener events so that memory leaks are avoided.
return function cleanup() {
ipcRenderer.removeAllListeners("test-success");
ipcRenderer.removeAllListeners(
"test-success",
ipcTypes.default.filewatcher.startSuccess
);
};
}, []);
@@ -33,6 +41,13 @@ export function App() {
>
Test IPC
</Button>
<Button
onClick={() => {
ipcRenderer.send(ipcTypes.default.filewatcher.start);
}}
>
Start Watcher
</Button>
</Layout.Content>
</Layout>
);