Remove global version of appEventBus (#6096)

* Remove global version of appEventBus

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

* Introduce a temporary but better shape of ExecFileInjectable error

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

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-10-31 14:59:05 +02:00
1 parent ba349e8b8d
commit 900f02fd8c
53 files changed
+330 -283

No files matched your search

@@ -6,9 +6,9 @@ import { getInjectable } from "@ogre-tools/injectable";
import createLensWindowInjectable from "./create-lens-window.injectable";
import lensProxyPortInjectable from "../../../lens-proxy/lens-proxy-port.injectable";
import isMacInjectable from "../../../../common/vars/is-mac.injectable";
import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable";
import waitUntilBundledExtensionsAreLoadedInjectable from "./wait-until-bundled-extensions-are-loaded.injectable";
import { applicationWindowInjectionToken } from "./application-window-injection-token";
import emitAppEventInjectable from "../../../../common/app-event-bus/emit-event.injectable";
import { runInAction } from "mobx";
import appNameInjectable from "../../../../common/vars/app-name.injectable";
@@ -23,9 +23,9 @@ const createApplicationWindowInjectable = getInjectable({
const createLensWindow = di.inject(createLensWindowInjectable);
const isMac = di.inject(isMacInjectable);
const applicationName = di.inject(appNameInjectable);
const appEventBus = di.inject(appEventBusInjectable);
const waitUntilBundledExtensionsAreLoaded = di.inject(waitUntilBundledExtensionsAreLoadedInjectable);
const lensProxyPort = di.inject(lensProxyPortInjectable);
const emitAppEvent = di.inject(emitAppEventInjectable);
return createLensWindow({
id,
@@ -40,13 +40,13 @@ const createApplicationWindowInjectable = getInjectable({
titleBarStyle: isMac ? "hiddenInset" : "hidden",
centered: false,
onFocus: () => {
appEventBus.emit({ name: "app", action: "focus" });
emitAppEvent({ name: "app", action: "focus" });
},
onBlur: () => {
appEventBus.emit({ name: "app", action: "blur" });
emitAppEvent({ name: "app", action: "blur" });
},
onDomReady: () => {
appEventBus.emit({ name: "app", action: "dom-ready" });
emitAppEvent({ name: "app", action: "dom-ready" });
},
onClose: () => {
@@ -3,19 +3,19 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import appEventBusInjectable from "../../../common/app-event-bus/app-event-bus.injectable";
import emitAppEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
import { beforeQuitOfFrontEndInjectionToken } from "../runnable-tokens/before-quit-of-front-end-injection-token";
const emitCloseToEventBusInjectable = getInjectable({
id: "emit-close-to-event-bus",
instantiate: (di) => {
const appEventBus = di.inject(appEventBusInjectable);
const emitAppEvent = di.inject(emitAppEventInjectable);
return {
id: "emit-close-to-event-bus",
run: () => {
appEventBus.emit({ name: "app", action: "close" });
emitAppEvent({ name: "app", action: "close" });
},
};
},
@@ -3,19 +3,19 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import appEventBusInjectable from "../../../common/app-event-bus/app-event-bus.injectable";
import emitAppEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
import { afterApplicationIsLoadedInjectionToken } from "../runnable-tokens/after-application-is-loaded-injection-token";
const emitServiceStartToEventBusInjectable = getInjectable({
id: "emit-service-start-to-event-bus",
instantiate: (di) => {
const appEventBus = di.inject(appEventBusInjectable);
const emitAppEvent = di.inject(emitAppEventInjectable);
return {
id: "emit-service-start-to-event-bus",
run: () => {
appEventBus.emit({ name: "service", action: "start" });
emitAppEvent({ name: "service", action: "start" });
},
};
},