mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch to using competition for setupping IPC channel listeners
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
3782b36809
commit
815651e3ad
@ -3,25 +3,26 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { noop } from "lodash/fp";
|
|
||||||
import { ipcChannelListenerInjectionToken } from "./ipc-channel-listener-injection-token";
|
import { ipcChannelListenerInjectionToken } from "./ipc-channel-listener-injection-token";
|
||||||
import registerIpcChannelListenerInjectable
|
import registerIpcChannelListenerInjectable from "../app-paths/get-value-from-registered-channel/register-ipc-channel-listener.injectable";
|
||||||
from "../app-paths/get-value-from-registered-channel/register-ipc-channel-listener.injectable";
|
import { setupableInjectionToken } from "../../common/setupable-injection-token/setupable-injection-token";
|
||||||
|
|
||||||
const registerIpcChannelListenersInjectable = getInjectable({
|
const registerIpcChannelListenersInjectable = getInjectable({
|
||||||
id: "register-ipc-channel-listeners",
|
id: "register-ipc-channel-listeners",
|
||||||
|
|
||||||
setup: async di => {
|
instantiate: di => ({
|
||||||
const registerIpcChannelListener = await di.inject(registerIpcChannelListenerInjectable);
|
doSetup: async () => {
|
||||||
|
const registerIpcChannelListener = di.inject(registerIpcChannelListenerInjectable);
|
||||||
|
|
||||||
const listeners = await di.injectMany(ipcChannelListenerInjectionToken);
|
const listeners = di.injectMany(ipcChannelListenerInjectionToken);
|
||||||
|
|
||||||
listeners.forEach(listener => {
|
listeners.forEach(listener => {
|
||||||
registerIpcChannelListener(listener);
|
registerIpcChannelListener(listener);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
instantiate: () => noop,
|
injectionToken: setupableInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default registerIpcChannelListenersInjectable;
|
export default registerIpcChannelListenersInjectable;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user