1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/common/cluster-ipc.ts
Roman 13c29a7fed refactoring, fixes
Signed-off-by: Roman <ixrock@gmail.com>
2020-07-21 16:01:20 +03:00

28 lines
888 B
TypeScript

import { createIpcChannel } from "./ipc";
import { ClusterId, clusterStore } from "./cluster-store";
import { tracker } from "./tracker";
export const clusterIpc = {
activate: createIpcChannel({
channel: "cluster:activate",
handle: async (clusterId: ClusterId = clusterStore.activeClusterId) => {
return clusterStore.getById(clusterId)?.activate();
},
}),
disconnect: createIpcChannel({
channel: "cluster:disconnect",
handle: (clusterId: ClusterId = clusterStore.activeClusterId) => {
tracker.event("cluster", "stop");
return clusterStore.getById(clusterId)?.disconnect();
},
}),
reconnect: createIpcChannel({
channel: "cluster:reconnect",
handle: (clusterId: ClusterId = clusterStore.activeClusterId) => {
tracker.event("cluster", "reconnect");
return clusterStore.getById(clusterId)?.reconnect();
},
}),
}