mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove electron-reload, replace with more light-weight electron-reload
Signed-off-by: Hung-Han (Henry) Chen <1474479+chenhunghan@users.noreply.github.com>
This commit is contained in:
4 files changed
+44
-74
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import path from "path";
|
||||
import logger from "./logger";
|
||||
|
||||
/**
|
||||
* Use electron-reload to watch changes of main.js
|
||||
* and reload electron windows if /static/build/main.js changes
|
||||
* The dependency is not bundled to the production build.
|
||||
*/
|
||||
export const reload = async () => {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
// eslint-disable-next-line
|
||||
require("electron-reload")(`${process.cwd()}/static/build/main.js`, {
|
||||
electron: path.join(process.cwd(), "node_modules", ".bin", "electron"),
|
||||
hardResetMethod: "exit"
|
||||
});
|
||||
|
||||
logger.info(`🔍 electron-reloadelectron-reload watching for main.js change......"`);
|
||||
}
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import { initMenu } from "./menu";
|
||||
import { initTray } from "./tray";
|
||||
import { Singleton } from "../common/utils";
|
||||
import { ClusterFrameInfo, clusterFrameMap } from "../common/cluster-frames";
|
||||
import { reload } from "./reload";
|
||||
|
||||
export class WindowManager extends Singleton {
|
||||
protected mainWindow: BrowserWindow;
|
||||
@@ -74,6 +75,8 @@ export class WindowManager extends Singleton {
|
||||
appEventBus.emit({name: "app", action: "blur"});
|
||||
});
|
||||
|
||||
await reload();
|
||||
|
||||
// clean up
|
||||
this.mainWindow.on("closed", () => {
|
||||
this.windowState.unmanage();
|
||||
|
||||
Reference in new issue
Block a user