1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/electron-app/runnables/setup-runnables-after-window-is-opened.injectable.ts
Sebastian Malton 38a5ab3ec8 Fix kubeconfig-sync sometimes producing multiple identical entities (#5855)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-10-24 16:03:33 -04:00

33 lines
1.2 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
import electronAppInjectable from "../electron-app.injectable";
import { runManyFor } from "../../../common/runnable/run-many-for";
import { afterWindowIsOpenedInjectionToken } from "../../start-main-application/runnable-tokens/after-window-is-opened-injection-token";
const setupRunnablesAfterWindowIsOpenedInjectable = getInjectable({
id: "setup-runnables-after-window-is-opened",
instantiate: (di) => {
const afterWindowIsOpened = runManyFor(di)(afterWindowIsOpenedInjectionToken);
return {
id: "setup-runnables-after-window-is-opened",
run: () => {
const app = di.inject(electronAppInjectable);
app.on("browser-window-created", async () => {
await afterWindowIsOpened();
});
},
};
},
injectionToken: beforeElectronIsReadyInjectionToken,
});
export default setupRunnablesAfterWindowIsOpenedInjectable;