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_run_passive__, #__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.
260 261 262 263 264 265 |
# File 'lib/dommy/web_socket.rb', line 260 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.
267 268 269 |
# File 'lib/dommy/web_socket.rb', line 267 def code @code end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
267 268 269 |
# File 'lib/dommy/web_socket.rb', line 267 def reason @reason end |
#was_clean ⇒ Object (readonly)
Returns the value of attribute was_clean.
267 268 269 |
# File 'lib/dommy/web_socket.rb', line 267 def was_clean @was_clean end |
Instance Method Details
#__js_get__(key) ⇒ Object
269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/dommy/web_socket.rb', line 269 def __js_get__(key) case key when "code" @code when "reason" @reason when "wasClean" @was_clean else super end end |