Михаил Капелько 10 months ago
parent
commit
576f67e882
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      Modules/BusX/Bus/src/Bus.swift

+ 7
- 7
Modules/BusX/Bus/src/Bus.swift View File

@@ -16,7 +16,7 @@ public extension Bus {
_ handler: @escaping ((String, T) -> Void), _ handler: @escaping ((String, T) -> Void),
_ subscriptions: inout [AnyCancellable] _ subscriptions: inout [AnyCancellable]
) { ) {
Self.events
e
.compactMap { convertKeyValue(keys, $0) } .compactMap { convertKeyValue(keys, $0) }
.receive(on: DispatchQueue.main) .receive(on: DispatchQueue.main)
.sink { v in handler(v.0, v.1) } .sink { v in handler(v.0, v.1) }
@@ -29,7 +29,7 @@ public extension Bus {
_ handler: @escaping ((String, T) -> Void), _ handler: @escaping ((String, T) -> Void),
_ subscriptions: inout [AnyCancellable] _ subscriptions: inout [AnyCancellable]
) { ) {
Self.events
e
.compactMap { convertKeyValue(keys, $0) } .compactMap { convertKeyValue(keys, $0) }
.sink { v in handler(v.0, v.1) } .sink { v in handler(v.0, v.1) }
.store(in: &subscriptions) .store(in: &subscriptions)
@@ -43,7 +43,7 @@ public extension Bus {
) { ) {
node node
.receive(on: DispatchQueue.main) .receive(on: DispatchQueue.main)
.sink { v in Self.e.send((key, v)) }
.sink { v in e.send((key, v)) }
.store(in: &subscriptions) .store(in: &subscriptions)
} }
@@ -54,13 +54,13 @@ public extension Bus {
_ subscriptions: inout [AnyCancellable] _ subscriptions: inout [AnyCancellable]
) { ) {
node node
.sink { v in Self.e.send((key, v)) }
.sink { v in e.send((key, v)) }
.store(in: &subscriptions) .store(in: &subscriptions)
} }
/// Синхронно отправить событие в шину один раз. /// Синхронно отправить событие в шину один раз.
static func send(_ key: String, _ value: Any) { static func send(_ key: String, _ value: Any) {
Self.e.send((key, value))
e.send((key, value))
} }
} }


@@ -71,7 +71,7 @@ public extension Bus {
_ handler: @escaping ((Src) -> Dst?), _ handler: @escaping ((Src) -> Dst?),
_ subscriptions: inout [AnyCancellable] _ subscriptions: inout [AnyCancellable]
) { ) {
Self.events
e
.compactMap { processKeysValue($0, keysIn, handler) } .compactMap { processKeysValue($0, keysIn, handler) }
.receive(on: DispatchQueue.main) .receive(on: DispatchQueue.main)
.sink { vOut in Self.e.send((keyOut, vOut)) } .sink { vOut in Self.e.send((keyOut, vOut)) }
@@ -84,7 +84,7 @@ public extension Bus {
_ handler: @escaping ((Src) -> Dst?), _ handler: @escaping ((Src) -> Dst?),
_ subscriptions: inout [AnyCancellable] _ subscriptions: inout [AnyCancellable]
) { ) {
Self.events
e
.compactMap { processKeysValue($0, keysIn, handler) } .compactMap { processKeysValue($0, keysIn, handler) }
.sink { vOut in Self.e.send((keyOut, vOut)) } .sink { vOut in Self.e.send((keyOut, vOut)) }
.store(in: &subscriptions) .store(in: &subscriptions)


Loading…
Cancel
Save