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


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

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


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

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

#animation_frameObject


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

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

#defer(*args, &block) ⇒ Object


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

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


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

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


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

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