Class: Dommy::CloseEvent
Overview
‘CloseEvent` — payload for the `close` event on WebSocket.
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
#__js_call__, #__js_set__, #__prepare_for_dispatch__, #__record_path__, #__set_current_target__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?
Constructor Details
#initialize(type, init = nil) ⇒ CloseEvent
Returns a new instance of CloseEvent.
187 188 189 190 191 192 |
# File 'lib/dommy/web_socket.rb', line 187 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.
194 195 196 |
# File 'lib/dommy/web_socket.rb', line 194 def code @code end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
194 195 196 |
# File 'lib/dommy/web_socket.rb', line 194 def reason @reason end |
#was_clean ⇒ Object (readonly)
Returns the value of attribute was_clean.
194 195 196 |
# File 'lib/dommy/web_socket.rb', line 194 def was_clean @was_clean end |
Instance Method Details
#__js_get__(key) ⇒ Object
196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/dommy/web_socket.rb', line 196 def __js_get__(key) case key when "code" @code when "reason" @reason when "wasClean" @was_clean else super end end |