mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Reimplement setup for catalog syncing using runnables instead of non-OCP in index.ts
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
0d3728dba3
commit
9a7741f7cd
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import catalogEntityRegistryInjectable from "../catalog/catalog-entity-registry.injectable";
|
||||||
|
import { startCatalogSyncToRenderer } from "../catalog-pusher";
|
||||||
|
|
||||||
|
const catalogSyncToRendererInjectable = getInjectable({
|
||||||
|
id: "catalog-sync-to-renderer",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||||
|
|
||||||
|
let disposer: () => void;
|
||||||
|
|
||||||
|
return {
|
||||||
|
start: () => {
|
||||||
|
disposer = startCatalogSyncToRenderer(catalogEntityRegistry);
|
||||||
|
},
|
||||||
|
|
||||||
|
stop: () => disposer?.(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default catalogSyncToRendererInjectable;
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { onRootFrameRenderInjectionToken } from "../start-main-application/on-root-frame-render/on-root-frame-render-injection-token";
|
||||||
|
import catalogSyncToRendererInjectable from "./catalog-sync-to-renderer.injectable";
|
||||||
|
|
||||||
|
const startCatalogSyncWhenRootFrameIsRenderedInjectable = getInjectable({
|
||||||
|
id: "start-catalog-sync-when-root-frame-is-rendered",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
run: () => {
|
||||||
|
catalogSyncToRenderer.start();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: onRootFrameRenderInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default startCatalogSyncWhenRootFrameIsRenderedInjectable;
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import catalogSyncToRendererInjectable from "./catalog-sync-to-renderer.injectable";
|
||||||
|
import { onApplicationCloseInjectionToken } from "../start-main-application/on-application-close/on-application-close-injection-token";
|
||||||
|
|
||||||
|
const stopCatalogSyncWhenApplicationIsClosedInjectable = getInjectable({
|
||||||
|
id: "stop-catalog-sync-when-application-is-closed",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
run: () => {
|
||||||
|
catalogSyncToRenderer.stop();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: onApplicationCloseInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default stopCatalogSyncWhenApplicationIsClosedInjectable;
|
||||||
Loading…
Reference in New Issue
Block a user