Class: Reacto::Operations::Throttle
- Inherits:
-
Object
- Object
- Reacto::Operations::Throttle
- Defined in:
- lib/reacto/operations/throttle.rb
Instance Method Summary collapse
- #call(tracker) ⇒ Object
-
#initialize(delay) ⇒ Throttle
constructor
A new instance of Throttle.
Constructor Details
Instance Method Details
#call(tracker) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/reacto/operations/throttle.rb', line 16 def call(tracker) close = -> () { @close = true } error = -> (e) do delay_task(tracker) unless @ready @error = e end value = -> (v) do delay_task(tracker) unless @ready @last = v end Subscriptions::OperationSubscription.new( tracker, value: value, close: close, error: error ) end |