From 8217ca888329a82181d878dc6287a795fd85edc6 Mon Sep 17 00:00:00 2001 From: Janne Savolainen Date: Wed, 25 May 2022 10:56:27 +0300 Subject: [PATCH] Remove duplication for disposers Co-authored-by: Mikko Aspiala Signed-off-by: Janne Savolainen --- src/common/channel/listening-of-channels.injectable.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/common/channel/listening-of-channels.injectable.ts b/src/common/channel/listening-of-channels.injectable.ts index a06c84980d..de4af36171 100644 --- a/src/common/channel/listening-of-channels.injectable.ts +++ b/src/common/channel/listening-of-channels.injectable.ts @@ -6,6 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import { getStartableStoppable } from "../utils/get-startable-stoppable"; import { channelListenerInjectionToken } from "./channel-listener-injection-token"; import { enlistChannelListenerInjectionToken } from "./enlist-channel-listener-injection-token"; +import { disposer } from "../utils"; const listeningOfChannelsInjectable = getInjectable({ id: "listening-of-channels", @@ -19,11 +20,7 @@ const listeningOfChannelsInjectable = getInjectable({ enlistChannelListener(channel, handler), ); - return () => { - disposers.forEach((disposer) => { - disposer(); - }); - }; + return disposer(...disposers); }); }, });