Module: Kernel
- Defined in:
- lib/reactive_record/interval.rb,
lib/reactive_record/interval.rb
Instance Method Summary collapse
-
#after(time, &block) ⇒ Delay
Execute a block after the given seconds.
-
#after!(time, &block) ⇒ Delay
Execute a block after the given seconds, you have to call [#start] on it yourself.
-
#every(time, &block) ⇒ Interval
Execute the block every given seconds.
-
#every!(time, &block) ⇒ Interval
Execute the block every given seconds, you have to call [#start] on it yourself.
Instance Method Details
#after(time, &block) ⇒ Delay
Execute a block after the given seconds.
170 171 172 |
# File 'lib/reactive_record/interval.rb', line 170 def after(time, &block) `setTimeout(#{block.to_n}, time * 1000)` end |
#after!(time, &block) ⇒ Delay
Execute a block after the given seconds, you have to call [#start] on it yourself.
175 176 177 |
# File 'lib/reactive_record/interval.rb', line 175 def after!(time, &block) `setTimeout(#{block.to_n}, time * 1000)` end |
#every(time, &block) ⇒ Interval
Execute the block every given seconds.
91 92 93 |
# File 'lib/reactive_record/interval.rb', line 91 def every(time, &block) $window.every(time, &block) end |
#every!(time, &block) ⇒ Interval
Execute the block every given seconds, you have to call [#start] on it yourself.
96 97 98 |
# File 'lib/reactive_record/interval.rb', line 96 def every!(time, &block) $window.every!(time, &block) end |