1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/technical-features/application/agnostic/src/start-application/start-application.injectable.ts
Sebastian Malton 0bd7b1fe92 feat: Compute the kubectl download version map at build time
- Allows for bundled kubectl config to be changed without code changes

- Introduce @k8slens/kubectl-versions

  - Compile time fetching of versions

- Update @swc/* packages

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2023-04-14 14:42:00 -04:00

32 lines
1.1 KiB
TypeScript

/* eslint-disable prettier/prettier */
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
import { runManyFor } from "@k8slens/run-many";
import * as timeSlots from "./time-slots";
export type StartApplication = () => Promise<void>;
export const startApplicationInjectionToken = getInjectionToken<StartApplication>({
id: "start-application-injection-token",
});
const startApplicationInjectable = getInjectable({
id: "start-application",
instantiate: (di): StartApplication => {
const runManyAsync = runManyFor(di);
const beforeApplicationIsLoading = runManyAsync(timeSlots.beforeApplicationIsLoadingInjectionToken);
const onLoadOfApplication = runManyAsync(timeSlots.onLoadOfApplicationInjectionToken);
const afterApplicationIsLoaded = runManyAsync(timeSlots.afterApplicationIsLoadedInjectionToken);
return async () => {
await beforeApplicationIsLoading();
await onLoadOfApplication();
await afterApplicationIsLoaded();
};
},
injectionToken: startApplicationInjectionToken,
});
export default startApplicationInjectable;