Added application settings and basic filewatcher.
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
11
src/ipc.types.js
Normal file
11
src/ipc.types.js
Normal file
@@ -0,0 +1,11 @@
|
||||
exports.default = {
|
||||
test: {
|
||||
start: "test-start",
|
||||
},
|
||||
filewatcher: {
|
||||
start: "filewatcher__start",
|
||||
startSuccess: "filewatcher__start-success",
|
||||
startFailure: "filewatcher__start-failure",
|
||||
stop: "filewatcher__stop",
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user