|
|
@@ -1,23 +1,23 @@ |
|
|
|
import BusX |
|
|
|
import Combine |
|
|
|
|
|
|
|
extension MeetupId { |
|
|
|
public extension Bus { |
|
|
|
final class Debounce<Src, Dst> { |
|
|
|
let v = PassthroughSubject<Src, Never>() |
|
|
|
var subscriptions = [AnyCancellable]() |
|
|
|
|
|
|
|
init( |
|
|
|
_ sec: Double, |
|
|
|
_ handler: @escaping ((Src) -> Dst?), |
|
|
|
_ sec: Double, |
|
|
|
_ src: String, |
|
|
|
_ dst: String |
|
|
|
) { |
|
|
|
// Вход. |
|
|
|
Bus.receiveSync( |
|
|
|
[src], |
|
|
|
{ [weak self] _, v in self?.v.send(v) }, |
|
|
|
&subscriptions |
|
|
|
) |
|
|
|
|
|
|
|
// Выход. |
|
|
|
Bus.sendSync( |
|
|
|
dst, |
|
|
|
v |