Class: Browser::Immediate
Overview
Class to easily create and dispatch an immediate call.
Immediate calls are deferred function calls that happen as soon as they can be scheduled.
Compatibility
The compatibility layer will try various implementations in the following order.
The order has been chosen from best to worst for both performance and preemptiveness.
Instance Method Summary collapse
-
#abort ⇒ Object
Abort the immediate.
-
#aborted? ⇒ Boolean
Check if the immediate has been aborted.
-
#dispatch ⇒ Object
Dispatch the immediate.
-
#initialize(func, args, &block) ⇒ Immediate
constructor
Create an immediate for the given function which will be called with the arguments and block.
- #prevent ⇒ Object
Constructor Details
#initialize(func, args, &block) ⇒ Immediate
Create an immediate for the given function which will be called with the arguments and block.
27 28 29 30 31 32 |
# File 'opal/browser/immediate.rb', line 27 def initialize(func, args, &block) @aborted = false @function = func @arguments = args @block = block end |
Instance Method Details
#abort ⇒ Object
Abort the immediate.
116 117 118 119 120 121 122 123 |
# File 'opal/browser/immediate.rb', line 116 def abort return if aborted? @aborted = true prevent self end |
#aborted? ⇒ Boolean
Check if the immediate has been aborted.
126 127 128 |
# File 'opal/browser/immediate.rb', line 126 def aborted? @aborted end |
#prevent ⇒ Object
46 47 48 |
# File 'opal/browser/immediate.rb', line 46 def prevent `window.clearImmediate(#@id)` end |