1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/start-main-application/lens-window/splash-window/splash-window.injectable.ts
Sebastian Malton 9847ad0b5a Fix ERR_FAILED for splash screen on windows sometimes
- This PR should be the equivalent of https://github.com/lensapp/lens/pull/5534

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-06-01 15:34:44 -04:00

38 lines
1.3 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 { lensWindowInjectionToken } from "../application-window/lens-window-injection-token";
import createLensWindowInjectable from "../application-window/create-lens-window.injectable";
import staticFilesDirectoryInjectable from "../../../../common/vars/static-files-directory.injectable";
import getAbsolutePathInjectable from "../../../../common/path/get-absolute-path.injectable";
const splashWindowInjectable = getInjectable({
id: "splash-window",
instantiate: (di) => {
const createLensWindow = di.inject(createLensWindowInjectable);
const staticFilesDirectory = di.inject(staticFilesDirectoryInjectable);
const getAbsolutePath = di.inject(getAbsolutePathInjectable);
const splashWindowFile = getAbsolutePath(staticFilesDirectory, "splash.html");
return createLensWindow({
id: "splash",
title: "Loading",
getContentSource: () => ({
file: splashWindowFile,
}),
defaultWidth: 500,
defaultHeight: 300,
resizable: false,
windowFrameUtilitiesAreShown: false,
centered: true,
});
},
injectionToken: lensWindowInjectionToken,
});
export default splashWindowInjectable;