Class: Dommy::AbortController
- Inherits:
-
Object
- Object
- Dommy::AbortController
- Includes:
- Bridge::Methods
- Defined in:
- lib/dommy/event.rb
Instance Attribute Summary collapse
-
#signal ⇒ Object
readonly
Returns the value of attribute signal.
Instance Method Summary collapse
- #__js_call__(method, args) ⇒ Object
- #__js_get__(key) ⇒ Object
- #__js_set__(_key, _value) ⇒ Object
-
#initialize ⇒ AbortController
constructor
A new instance of AbortController.
Methods included from Bridge::Methods
Constructor Details
#initialize ⇒ AbortController
Returns a new instance of AbortController.
1136 1137 1138 |
# File 'lib/dommy/event.rb', line 1136 def initialize @signal = AbortSignal.new end |
Instance Attribute Details
#signal ⇒ Object (readonly)
Returns the value of attribute signal.
1134 1135 1136 |
# File 'lib/dommy/event.rb', line 1134 def signal @signal end |
Instance Method Details
#__js_call__(method, args) ⇒ Object
1150 1151 1152 1153 1154 1155 1156 1157 |
# File 'lib/dommy/event.rb', line 1150 def __js_call__(method, args) case method when "abort" # `abort()` (no arg) defaults the reason; `abort(reason)` — even # `abort(null)` — keeps the explicit reason. args.empty? ? @signal.__internal_mark_aborted__ : @signal.__internal_mark_aborted__(args[0]) end end |
#__js_get__(key) ⇒ Object
1140 1141 1142 |
# File 'lib/dommy/event.rb', line 1140 def __js_get__(key) @signal if key == "signal" end |