mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- Fix some bugs about bad conditions Signed-off-by: Sebastian Malton <sebastian@malton.name>
32 lines
767 B
TypeScript
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;
|