1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/cluster-manager/emit-cluster-visibility.injectable.ts
Sebastian Malton 98e42cf25f
Make ClusterFrameManager fully injectable (#6590)
* Make ClusterFrameManager fully injectable

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

* Fix type errors

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

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-11-22 09:10:22 -05:00

22 lines
967 B
TypeScript

/**
* 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 type { MessageChannelHandler } from "../../../common/utils/channel/message-channel-listener-injection-token";
import { sendMessageToChannelInjectionToken } from "../../../common/utils/channel/message-to-channel-injection-token";
import { clusterVisibilityChannel } from "../../../common/cluster/visibility-channel";
export type EmitClusterVisibility = MessageChannelHandler<typeof clusterVisibilityChannel>;
const emitClusterVisibilityInjectable = getInjectable({
id: "emit-cluster-visibility",
instantiate: (di): EmitClusterVisibility => {
const sendMessageToChannel = di.inject(sendMessageToChannelInjectionToken);
return (id) => sendMessageToChannel(clusterVisibilityChannel, id);
},
});
export default emitClusterVisibilityInjectable;