1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

All changes

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2023-04-05 09:49:30 +03:00
parent 98ef8538a4
commit 59ce21609e
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A
3 changed files with 30 additions and 16 deletions

View File

@ -41,6 +41,8 @@ export function getStartableStoppable(id: string, startAndGetStopper: Starter):
stop: () => {
if (state !== "started") {
return;
throw new Error(`Tried to stop "${id}", but it is already ${state}.`);
}

View File

@ -9,8 +9,6 @@ import loggerInjectable from "../../../common/logger.injectable";
import extensionDiscoveryInjectable from "../../../extensions/extension-discovery/extension-discovery.injectable";
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.injectable";
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/on-load-of-application-injection-token";
import setupShellInjectable from "../../../features/shell-sync/main/setup-shell.injectable";
const initializeExtensionsInjectable = getInjectable({
id: "initialize-extensions",
@ -51,20 +49,20 @@ const initializeExtensionsInjectable = getInjectable({
"Lens Error",
`Could not load extensions${
error?.message ? `: ${error.message}` : ""
}`,
}`
);
console.error(error);
console.trace();
}
},
runAfter: di.inject(setupShellInjectable),
// runAfter: di.inject(setupShellInjectable),
};
},
causesSideEffects: true,
injectionToken: onLoadOfApplicationInjectionToken,
// injectionToken: onLoadOfApplicationInjectionToken,
});
export default initializeExtensionsInjectable;

View File

@ -7,11 +7,15 @@ import { getInjectable } from "@ogre-tools/injectable";
import { runManyFor } from "../../common/runnable/run-many-for";
import { runManySyncFor } from "../../common/runnable/run-many-sync-for";
import { beforeElectronIsReadyInjectionToken } from "./runnable-tokens/before-electron-is-ready-injection-token";
import { beforeApplicationIsLoadingInjectionToken } from "./runnable-tokens/before-application-is-loading-injection-token";
import { onLoadOfApplicationInjectionToken } from "./runnable-tokens/on-load-of-application-injection-token";
import { afterApplicationIsLoadedInjectionToken } from "./runnable-tokens/after-application-is-loaded-injection-token";
import waitForElectronToBeReadyInjectable from "../electron-app/features/wait-for-electron-to-be-ready.injectable";
import { appPathsRunnablePhaseInjectionToken, showInitialWindowRunnablePhaseInjectionToken, showLoadingRunnablePhaseInjectionToken } from "./runnable-tokens/phases";
import {
appPathsRunnablePhaseInjectionToken, showInitialWindowRunnablePhaseInjectionToken,
showLoadingRunnablePhaseInjectionToken,
} from "./runnable-tokens/phases";
import { beforeApplicationIsLoadingInjectionToken } from "./runnable-tokens/before-application-is-loading-injection-token";
import {
onLoadOfApplicationInjectionToken
} from "./runnable-tokens/on-load-of-application-injection-token";
const startMainApplicationInjectable = getInjectable({
id: "start-main-application",
@ -19,15 +23,25 @@ const startMainApplicationInjectable = getInjectable({
instantiate: (di) => {
const runMany = runManyFor(di);
const runManySync = runManySyncFor(di);
const waitForElectronToBeReady = di.inject(waitForElectronToBeReadyInjectable);
const waitForElectronToBeReady = di.inject(
waitForElectronToBeReadyInjectable
);
const appPathsRunnablePhase = runManySync(appPathsRunnablePhaseInjectionToken);
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
const beforeApplicationIsLoading = runMany(beforeApplicationIsLoadingInjectionToken);
const showLoadingRunnablePhase = runMany(showLoadingRunnablePhaseInjectionToken);
const appPathsRunnablePhase = runManySync(
appPathsRunnablePhaseInjectionToken
);
const beforeElectronIsReady = runManySync(
beforeElectronIsReadyInjectionToken
);
const beforeApplicationIsLoading = runMany(
beforeApplicationIsLoadingInjectionToken
);
const showLoadingRunnablePhase = runMany(
showLoadingRunnablePhaseInjectionToken
);
const onLoadOfApplication = runMany(onLoadOfApplicationInjectionToken);
const showInitialWindowRunnablePhase = runMany(showInitialWindowRunnablePhaseInjectionToken);
const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken);
// const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken);
return () => {
// Stuff happening before application is ready needs to be synchronous because of
@ -41,7 +55,7 @@ const startMainApplicationInjectable = getInjectable({
await showLoadingRunnablePhase();
await onLoadOfApplication();
await showInitialWindowRunnablePhase();
await afterApplicationIsLoaded();
// await afterApplicationIsLoaded();
})();
};
},