Class: Browser::Window

Inherits:
Object show all
Defined in:
lib/reactive_record/interval.rb,
lib/reactive_record/interval.rb

Instance Method Summary collapse

Instance Method Details

#after(time, &block) ⇒ Delay

Execute a block after the given seconds.

Parameters:

  • time (Float)

    the seconds after it gets called

Returns:

  • (Delay)

    the object representing the timeout



151
152
153
# File 'lib/reactive_record/interval.rb', line 151

def after(time, &block)
  Delay.new(@native, time, &block).tap(&:start)
end

#after!(time, &block) ⇒ Delay

Execute a block after the given seconds, you have to call [#start] on it yourself.

Parameters:

  • time (Float)

    the seconds after it gets called

Returns:

  • (Delay)

    the object representing the timeout



161
162
163
# File 'lib/reactive_record/interval.rb', line 161

def after!(time, &block)
  Delay.new(@native, time, &block)
end

#every(time, &block) ⇒ Interval

Execute the block every given seconds.

Parameters:

  • time (Float)

    the seconds between every call

Returns:

  • (Interval)

    the object representing the interval



72
73
74
# File 'lib/reactive_record/interval.rb', line 72

def every(time, &block)
  Interval.new(@native, time, &block).tap(&:start)
end

#every!(time, &block) ⇒ Interval

Execute the block every given seconds, you have to call [#start] on it yourself.

Parameters:

  • time (Float)

    the seconds between every call

Returns:

  • (Interval)

    the object representing the interval



82
83
84
# File 'lib/reactive_record/interval.rb', line 82

def every!(time, &block)
  Interval.new(@native, time, &block)
end