49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
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 mapStateToProps = createStructuredSelector({});
|
|
const mapDispatchToProps = (dispatch) => ({});
|
|
|
|
export function App() {
|
|
useEffect(() => {
|
|
ipcRenderer.on("not a real channel", (event, obj) => {
|
|
console.log("not a real channel", obj);
|
|
});
|
|
// Cleanup the listener events so that memory leaks are avoided.
|
|
return function cleanup() {
|
|
ipcRenderer.removeAllListeners("not a real channel");
|
|
};
|
|
}, []);
|
|
|
|
return (
|
|
<Layout>
|
|
<Layout.Header>
|
|
<div> Header</div>
|
|
</Layout.Header>
|
|
<Layout.Content>
|
|
<div>Welcome to your new react app. asdas sd</div>
|
|
<Button
|
|
onClick={() => {
|
|
ipcRenderer.send("test", { test: true });
|
|
}}
|
|
>
|
|
TEST Generic IPC
|
|
</Button>
|
|
<Button
|
|
onClick={() => {
|
|
ipcRenderer.send(ipcTypes.default.filewatcher.start);
|
|
}}
|
|
>
|
|
Start Watcher
|
|
</Button>
|
|
</Layout.Content>
|
|
</Layout>
|
|
);
|
|
}
|
|
export default connect(mapStateToProps, mapDispatchToProps)(App);
|