Class: Proc

Inherits:
Object show all
Defined in:
opal/fron/core_ext/proc.rb

Overview

Proc

Instance Method Summary collapse

Instance Method Details

#debounce(ms, leading = false) ⇒ Object

Runs the given block after the given wait period if called continously. The wait period restarts with each call

Parameters:

  • ms (Numeric)

    The wait period

  • leading (Boolean) (defaults to: false)

    To run the function at the start or not



16
17
18
# File 'opal/fron/core_ext/proc.rb', line 16

def debounce(ms, leading = false)
  Native `debounce(#{self}, #{ms}, #{leading})`
end

#throttle(ms) ⇒ Object

Runs the given block after the given wait period if called continously

Parameters:



7
8
9
# File 'opal/fron/core_ext/proc.rb', line 7

def throttle(ms)
  Native `throttle(#{self}, #{ms}, {leading: false})`
end