diff --git a/src/common/initializable-state/create-lazy.ts b/src/common/initializable-state/create-lazy.ts deleted file mode 100644 index ca6a8f41bc..0000000000 --- a/src/common/initializable-state/create-lazy.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ - -import type { DiContainerForInjection, Injectable } from "@ogre-tools/injectable"; -import { getInjectable } from "@ogre-tools/injectable"; -import type { InitializableStateValue } from "./create"; - -export interface CreateLazyInitializableStateArgs { - id: string; - init: (di: DiContainerForInjection) => T; -} - -export interface LazyInitializableState { - get: () => T; -} - -export function createLazyInitializableState(args: CreateLazyInitializableStateArgs): Injectable, unknown, void> { - const { id, init } = args; - - return getInjectable({ - id, - instantiate: (di): LazyInitializableState => { - let box: InitializableStateValue = { - set: false, - }; - - return { - get: () => { - if (box.set === false) { - box = { - set: true, - value: init(di), - }; - } - - return box.value; - }, - }; - }, - }); -}