|
- import Combine
-
- public extension Bus {
- final class Receiver<T> {
- var subscriptions = [AnyCancellable]()
-
- public init(
- _ keys: Set<String>,
- _ handler: @escaping ((String, T) -> Void),
- opt: [Option] = []
- ) {
- Bus.receive(keys, handler, opt: opt, sub: &subscriptions)
- }
- }
- }
- import Combine
-
- public extension Bus {
- final class Sender<T> {
- var subscriptions = [AnyCancellable]()
-
- public init(
- _ key: String,
- _ node: AnyPublisher<T, Never>,
- opt: [Option] = []
- ) {
- Bus.send(key, node, opt: opt, sub: &subscriptions)
- }
- }
- }
|