d
This commit is contained in:
@@ -16,7 +16,7 @@ public extension Bus {
|
||||
_ handler: @escaping ((String, T) -> Void),
|
||||
_ subscriptions: inout [AnyCancellable]
|
||||
) {
|
||||
Self.events
|
||||
e
|
||||
.compactMap { convertKeyValue(keys, $0) }
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { v in handler(v.0, v.1) }
|
||||
@@ -29,7 +29,7 @@ public extension Bus {
|
||||
_ handler: @escaping ((String, T) -> Void),
|
||||
_ subscriptions: inout [AnyCancellable]
|
||||
) {
|
||||
Self.events
|
||||
e
|
||||
.compactMap { convertKeyValue(keys, $0) }
|
||||
.sink { v in handler(v.0, v.1) }
|
||||
.store(in: &subscriptions)
|
||||
@@ -43,7 +43,7 @@ public extension Bus {
|
||||
) {
|
||||
node
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { v in Self.e.send((key, v)) }
|
||||
.sink { v in e.send((key, v)) }
|
||||
.store(in: &subscriptions)
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ public extension Bus {
|
||||
_ subscriptions: inout [AnyCancellable]
|
||||
) {
|
||||
node
|
||||
.sink { v in Self.e.send((key, v)) }
|
||||
.sink { v in e.send((key, v)) }
|
||||
.store(in: &subscriptions)
|
||||
}
|
||||
|
||||
/// Синхронно отправить событие в шину один раз.
|
||||
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?),
|
||||
_ subscriptions: inout [AnyCancellable]
|
||||
) {
|
||||
Self.events
|
||||
e
|
||||
.compactMap { processKeysValue($0, keysIn, handler) }
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { vOut in Self.e.send((keyOut, vOut)) }
|
||||
@@ -84,7 +84,7 @@ public extension Bus {
|
||||
_ handler: @escaping ((Src) -> Dst?),
|
||||
_ subscriptions: inout [AnyCancellable]
|
||||
) {
|
||||
Self.events
|
||||
e
|
||||
.compactMap { processKeysValue($0, keysIn, handler) }
|
||||
.sink { vOut in Self.e.send((keyOut, vOut)) }
|
||||
.store(in: &subscriptions)
|
||||
|
||||
Reference in New Issue
Block a user