Class: Dommy::CloseEvent
Overview
‘CloseEvent` — payload for the `close` event on WebSocket.
Constant Summary
Constants inherited from Event
Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#was_clean ⇒ Object
readonly
Returns the value of attribute was_clean.
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ CloseEvent
constructor
A new instance of CloseEvent.
Methods inherited from Event
#__internal_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_set_current_target__, #__internal_set_dispatch_flag__, #__internal_set_event_phase__, #__js_call__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?
Methods included from Bridge::Methods
Constructor Details
#initialize(type, init = nil) ⇒ CloseEvent
Returns a new instance of CloseEvent.
217 218 219 220 221 222 |
# File 'lib/dommy/web_socket.rb', line 217 def initialize(type, init = nil) super @code = (read_init(init, "code") || 1005).to_i @reason = (read_init(init, "reason") || "").to_s @was_clean = !!read_init(init, "wasClean") end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
224 225 226 |
# File 'lib/dommy/web_socket.rb', line 224 def code @code end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
224 225 226 |
# File 'lib/dommy/web_socket.rb', line 224 def reason @reason end |
#was_clean ⇒ Object (readonly)
Returns the value of attribute was_clean.
224 225 226 |
# File 'lib/dommy/web_socket.rb', line 224 def was_clean @was_clean end |
Instance Method Details
#__js_get__(key) ⇒ Object
226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/dommy/web_socket.rb', line 226 def __js_get__(key) case key when "code" @code when "reason" @reason when "wasClean" @was_clean else super end end |