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 807f98ed1b
Persist apiVersion when editing resources in monaco (#4406)
* Persist apiVersion when editing resources in monaco

- Use a new custom k8slens prefixed label

- Means that users aren't surprised when they use lens to update a
  resource to a new apiVersionWithGroup

- Doesn't touch the versions in the stores

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix: Fix lint issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* chore: make lint not bail on failure

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* chore: Run lint:fix on all files

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2023-04-05 10:56:23 -04:00

31 lines
1.0 KiB
TypeScript

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;