mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Rename AsyncSyncBox to InitializableState
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
80dc137110
commit
54f4c51791
@ -6,20 +6,20 @@
|
||||
import type { DiContainerForInjection } from "@ogre-tools/injectable";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
export interface CreateAsyncSyncBoxArgs<T> {
|
||||
export interface CreateInitializableStateArgs<T> {
|
||||
id: string;
|
||||
init: (di: DiContainerForInjection) => Promise<T>;
|
||||
}
|
||||
|
||||
type AsyncSyncBoxValue<T> = { set: false } | { set: true; value: T };
|
||||
type InitializableStateValue<T> = { set: false } | { set: true; value: T };
|
||||
|
||||
export function createAsyncSyncBox<T>(args: CreateAsyncSyncBoxArgs<T>) {
|
||||
export function createInitializableState<T>(args: CreateInitializableStateArgs<T>) {
|
||||
const { id, init } = args;
|
||||
|
||||
return getInjectable({
|
||||
id,
|
||||
instantiate: (di) => {
|
||||
let box: AsyncSyncBoxValue<T> = {
|
||||
let box: InitializableStateValue<T> = {
|
||||
set: false,
|
||||
};
|
||||
let initCalled = false;
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { buildVersionInjectionToken } from "../../../common/vars/build-semantic-version.injectable";
|
||||
import buildVersionAsyncSyncBoxInjectable from "./box.injectable";
|
||||
import buildVersionAsyncSyncBoxInjectable from "./state.injectable";
|
||||
|
||||
const buildVersionInjectable = getInjectable({
|
||||
id: "build-version",
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeFrameStartsInjectionToken } from "../../before-frame-starts/before-frame-starts-injection-token";
|
||||
import buildVersionAsyncSyncBoxInjectable from "./box.injectable";
|
||||
import buildVersionAsyncSyncBoxInjectable from "./state.injectable";
|
||||
|
||||
const initializeBuildVersionAsyncSyncBoxInjectable = getInjectable({
|
||||
id: "initialize-build-version-async-sync-box",
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { createAsyncSyncBox } from "../../../common/async-sync/create";
|
||||
import { createInitializableState } from "../../../common/initializable-state/create";
|
||||
import { requestFromChannelInjectionToken } from "../../../common/utils/channel/request-from-channel-injection-token";
|
||||
import { buildVersionChannel } from "../../../common/vars/build-semantic-version.injectable";
|
||||
|
||||
const buildVersionAsyncSyncBoxInjectable = createAsyncSyncBox({
|
||||
const buildVersionAsyncSyncBoxInjectable = createInitializableState({
|
||||
id: "build-version",
|
||||
init: (di) => {
|
||||
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
|
||||
Loading…
Reference in New Issue
Block a user