feat: electron-toolkit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
// type Props = {};
|
||||
|
||||
const Electron = () => {
|
||||
useEffect(() => {
|
||||
if (window.electron === undefined) return;
|
||||
const handleData = (_: any, arg: any) => {
|
||||
console.log("electron msg", arg);
|
||||
};
|
||||
console.log("ttttt", window.electron.process.platform);
|
||||
window.electron.ipcRenderer.on("server-name-popover", handleData);
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default Electron;
|
||||
@@ -4,11 +4,13 @@ import { Provider } from "react-redux";
|
||||
import { HashRouter, Route, Routes } from "react-router-dom";
|
||||
import { isEqual } from "lodash";
|
||||
|
||||
import Electron from "@/components/Electron";
|
||||
import Meta from "@/components/Meta";
|
||||
import useDeviceToken from "@/components/Notification/useDeviceToken";
|
||||
import RequireAuth from "@/components/RequireAuth";
|
||||
import RequireNoAuth from "@/components/RequireNoAuth";
|
||||
import RequireSingleTab from "@/components/RequireSingleTab";
|
||||
import { isElectronContext } from "@/utils";
|
||||
import { vapidKey } from "../app/config";
|
||||
import store, { useAppSelector } from "../app/store";
|
||||
import NotFoundPage from "./404";
|
||||
@@ -296,6 +298,7 @@ const PageRoutes = () => {
|
||||
export default function ReduxRoutes() {
|
||||
return (
|
||||
<Provider store={store}>
|
||||
{isElectronContext() && <Electron />}
|
||||
<Meta />
|
||||
<PageRoutes />
|
||||
</Provider>
|
||||
|
||||
Vendored
+2
-1
@@ -1,5 +1,5 @@
|
||||
import { IAgoraRTCClient, ICameraVideoTrack, ILocalAudioTrack, ILocalVideoTrack, IMicrophoneAudioTrack, IRemoteAudioTrack, IRemoteVideoTrack } from "agora-rtc-sdk-ng";
|
||||
|
||||
import {ElectronAPI} from '@electron-toolkit/preload';
|
||||
interface BeforeInstallPromptEvent extends Event {
|
||||
/**
|
||||
* Returns an array of DOMString items containing the platforms on which the event was dispatched.
|
||||
@@ -28,6 +28,7 @@ export declare global {
|
||||
import localforage from "localforage";
|
||||
|
||||
interface Window {
|
||||
electron: ElectronAPI;
|
||||
__WB_MANIFEST: Array<PrecacheEntry | string>;
|
||||
skipWaiting: () => void;
|
||||
CACHE: { [key: string]: typeof localforage | undefined };
|
||||
|
||||
Reference in New Issue
Block a user