mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Reimplement setup for electron application name using runnables instead of non-OCP in index.ts
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
9c3c075887
commit
74f8d7462e
@ -3,11 +3,13 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import electronAppInjectable from "../get-electron-app-path/electron-app/electron-app.injectable";
|
||||
import { isDevelopment } from "../../../common/vars";
|
||||
import packageInfo from "../../../../package.json";
|
||||
|
||||
const appNameInjectable = getInjectable({
|
||||
id: "app-name",
|
||||
instantiate: (di) => di.inject(electronAppInjectable).name,
|
||||
instantiate: () => `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`,
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default appNameInjectable;
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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 electronAppInjectable from "../../../app-paths/get-electron-app-path/electron-app/electron-app.injectable";
|
||||
import appNameInjectable from "../../../app-paths/app-name/app-name.injectable";
|
||||
import { beforeApplicationIsReadyInjectionToken } from "../before-application-is-ready-injection-token";
|
||||
|
||||
const setupApplicationNameInjectable = getInjectable({
|
||||
id: "setup-application-name",
|
||||
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const appName = di.inject(appNameInjectable);
|
||||
|
||||
app.setName(appName);
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeApplicationIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
export default setupApplicationNameInjectable;
|
||||
Loading…
Reference in New Issue
Block a user