mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 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 splashWindowInjectable from "./splash-window/splash-window.injectable";
|
|
import applicationWindowInjectable from "./application-window/application-window.injectable";
|
|
import { identity, some } from "lodash/fp";
|
|
const someIsTruthy = some(identity);
|
|
|
|
const showApplicationWindowInjectable = getInjectable({
|
|
id: "show-application-window",
|
|
|
|
instantiate: (di) => {
|
|
const applicationWindow = di.inject(applicationWindowInjectable);
|
|
|
|
const splashWindow = di.inject(splashWindowInjectable);
|
|
|
|
return async () => {
|
|
const windowIsAlreadyBeingShown = someIsTruthy([
|
|
applicationWindow.visible,
|
|
applicationWindow.opening,
|
|
splashWindow.visible,
|
|
splashWindow.opening,
|
|
]);
|
|
|
|
if (windowIsAlreadyBeingShown) {
|
|
return;
|
|
}
|
|
|
|
await splashWindow.show();
|
|
|
|
await applicationWindow.show();
|
|
|
|
splashWindow.close();
|
|
};
|
|
},
|
|
});
|
|
|
|
export default showApplicationWindowInjectable;
|