Class: Proc

Inherits:
Object show all
Defined in:
opal/browser/delay.rb,
opal/browser/interval.rb,
opal/browser/immediate.rb,
opal/browser/animation_frame.rb

Instance Method Summary collapse

Instance Method Details

#after(time) ⇒ Delay

Execute a block after the given seconds.

Parameters:

  • time (Float)

    the seconds after it gets called

Returns:

  • (Delay)

    the object representing the timeout



87
88
89
# File 'opal/browser/delay.rb', line 87

def after(time)
  $window.after(time, &self)
end

#after!(time) ⇒ 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



92
93
94
# File 'opal/browser/delay.rb', line 92

def after!(time)
  $window.after!(time, &self)
end

#animation_frameObject



109
110
111
# File 'opal/browser/animation_frame.rb', line 109

def animation_frame
  Browser::AnimationFrame.new($window, &self)
end

#defer(*args, &block) ⇒ Object



142
143
144
# File 'opal/browser/immediate.rb', line 142

def defer(*args, &block)
  Browser::Immediate.new(self, args, &block).tap(&:dispatch)
end

#every(time) ⇒ Interval

Execute the block every given seconds.

Parameters:

  • time (Float)

    the seconds between every call

Returns:

  • (Interval)

    the object representing the interval



104
105
106
# File 'opal/browser/interval.rb', line 104

def every(time)
  $window.every(time, &self)
end

#every!(time) ⇒ 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



109
110
111
# File 'opal/browser/interval.rb', line 109

def every!(time)
  $window.every!(time, &self)
end