Class: Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/red_query/timer.rb

Instance Method Summary collapse

Constructor Details

#initialize(time, &block) ⇒ Timer

Returns a new instance of Timer.



2
3
4
# File 'lib/red_query/timer.rb', line 2

def initialize(time, &block)
  @timer = `setTimeout(function () { #{block.call} }, #{time})`
end

Instance Method Details

#clearObject



6
7
8
# File 'lib/red_query/timer.rb', line 6

def clear
  `clearTimeout(#{@timer})`
end