1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/core/src/common/app-paths/app-paths-state.injectable.ts
Sebastian Malton 1675c56e59 chore: Turn on @typescript-eslint/strict-boolean-expressions
- Fix some bugs about bad conditions

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2023-06-01 09:27:44 -04:00

32 lines
767 B
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 assert from "assert";
import type { AppPaths } from "./app-path-injection-token";
const appPathsStateInjectable = getInjectable({
id: "app-paths-state",
instantiate: () => {
let state: AppPaths | undefined;
return {
get: () =>{
assert(state, "Tried to get app paths before initialization");
return state;
},
set: (newState: AppPaths) => {
assert(!state, "Tried to overwrite existing state of app paths");
state = newState;
},
};
},
});
export default appPathsStateInjectable;