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:
parent
98ef8538a4
commit
59ce21609e
@ -41,6 +41,8 @@ export function getStartableStoppable(id: string, startAndGetStopper: Starter):
|
|||||||
|
|
||||||
stop: () => {
|
stop: () => {
|
||||||
if (state !== "started") {
|
if (state !== "started") {
|
||||||
|
return;
|
||||||
|
|
||||||
throw new Error(`Tried to stop "${id}", but it is already ${state}.`);
|
throw new Error(`Tried to stop "${id}", but it is already ${state}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,6 @@ import loggerInjectable from "../../../common/logger.injectable";
|
|||||||
import extensionDiscoveryInjectable from "../../../extensions/extension-discovery/extension-discovery.injectable";
|
import extensionDiscoveryInjectable from "../../../extensions/extension-discovery/extension-discovery.injectable";
|
||||||
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
|
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
|
||||||
import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.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({
|
const initializeExtensionsInjectable = getInjectable({
|
||||||
id: "initialize-extensions",
|
id: "initialize-extensions",
|
||||||
@ -51,20 +49,20 @@ const initializeExtensionsInjectable = getInjectable({
|
|||||||
"Lens Error",
|
"Lens Error",
|
||||||
`Could not load extensions${
|
`Could not load extensions${
|
||||||
error?.message ? `: ${error.message}` : ""
|
error?.message ? `: ${error.message}` : ""
|
||||||
}`,
|
}`
|
||||||
);
|
);
|
||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
console.trace();
|
console.trace();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
runAfter: di.inject(setupShellInjectable),
|
// runAfter: di.inject(setupShellInjectable),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
|
|
||||||
injectionToken: onLoadOfApplicationInjectionToken,
|
// injectionToken: onLoadOfApplicationInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default initializeExtensionsInjectable;
|
export default initializeExtensionsInjectable;
|
||||||
|
|||||||
@ -7,11 +7,15 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import { runManyFor } from "../../common/runnable/run-many-for";
|
import { runManyFor } from "../../common/runnable/run-many-for";
|
||||||
import { runManySyncFor } from "../../common/runnable/run-many-sync-for";
|
import { runManySyncFor } from "../../common/runnable/run-many-sync-for";
|
||||||
import { beforeElectronIsReadyInjectionToken } from "./runnable-tokens/before-electron-is-ready-injection-token";
|
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 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({
|
const startMainApplicationInjectable = getInjectable({
|
||||||
id: "start-main-application",
|
id: "start-main-application",
|
||||||
@ -19,15 +23,25 @@ const startMainApplicationInjectable = getInjectable({
|
|||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const runMany = runManyFor(di);
|
const runMany = runManyFor(di);
|
||||||
const runManySync = runManySyncFor(di);
|
const runManySync = runManySyncFor(di);
|
||||||
const waitForElectronToBeReady = di.inject(waitForElectronToBeReadyInjectable);
|
const waitForElectronToBeReady = di.inject(
|
||||||
|
waitForElectronToBeReadyInjectable
|
||||||
|
);
|
||||||
|
|
||||||
const appPathsRunnablePhase = runManySync(appPathsRunnablePhaseInjectionToken);
|
const appPathsRunnablePhase = runManySync(
|
||||||
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
|
appPathsRunnablePhaseInjectionToken
|
||||||
const beforeApplicationIsLoading = runMany(beforeApplicationIsLoadingInjectionToken);
|
);
|
||||||
const showLoadingRunnablePhase = runMany(showLoadingRunnablePhaseInjectionToken);
|
const beforeElectronIsReady = runManySync(
|
||||||
|
beforeElectronIsReadyInjectionToken
|
||||||
|
);
|
||||||
|
const beforeApplicationIsLoading = runMany(
|
||||||
|
beforeApplicationIsLoadingInjectionToken
|
||||||
|
);
|
||||||
|
const showLoadingRunnablePhase = runMany(
|
||||||
|
showLoadingRunnablePhaseInjectionToken
|
||||||
|
);
|
||||||
const onLoadOfApplication = runMany(onLoadOfApplicationInjectionToken);
|
const onLoadOfApplication = runMany(onLoadOfApplicationInjectionToken);
|
||||||
const showInitialWindowRunnablePhase = runMany(showInitialWindowRunnablePhaseInjectionToken);
|
const showInitialWindowRunnablePhase = runMany(showInitialWindowRunnablePhaseInjectionToken);
|
||||||
const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken);
|
// const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
// Stuff happening before application is ready needs to be synchronous because of
|
// Stuff happening before application is ready needs to be synchronous because of
|
||||||
@ -41,7 +55,7 @@ const startMainApplicationInjectable = getInjectable({
|
|||||||
await showLoadingRunnablePhase();
|
await showLoadingRunnablePhase();
|
||||||
await onLoadOfApplication();
|
await onLoadOfApplication();
|
||||||
await showInitialWindowRunnablePhase();
|
await showInitialWindowRunnablePhase();
|
||||||
await afterApplicationIsLoaded();
|
// await afterApplicationIsLoaded();
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user