Class: Dommy::MessageEvent
Overview
‘MessageEvent` — payload of `message` events on MessagePort / BroadcastChannel / WebSocket / EventSource.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#last_event_id ⇒ Object
readonly
Returns the value of attribute last_event_id.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ MessageEvent
constructor
A new instance of MessageEvent.
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) ⇒ MessageEvent
Returns a new instance of MessageEvent.
133 134 135 136 137 138 139 140 |
# File 'lib/dommy/message_channel.rb', line 133 def initialize(type, init = nil) super @data = read_init(init, "data") @origin = (read_init(init, "origin") || "").to_s @last_event_id = (read_init(init, "lastEventId") || "").to_s @source = read_init(init, "source") @ports = read_init(init, "ports") || [] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
142 143 144 |
# File 'lib/dommy/message_channel.rb', line 142 def data @data end |
#last_event_id ⇒ Object (readonly)
Returns the value of attribute last_event_id.
142 143 144 |
# File 'lib/dommy/message_channel.rb', line 142 def last_event_id @last_event_id end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
142 143 144 |
# File 'lib/dommy/message_channel.rb', line 142 def origin @origin end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports.
142 143 144 |
# File 'lib/dommy/message_channel.rb', line 142 def ports @ports end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
142 143 144 |
# File 'lib/dommy/message_channel.rb', line 142 def source @source end |
Instance Method Details
#__js_get__(key) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/dommy/message_channel.rb', line 144 def __js_get__(key) case key when "data" @data when "origin" @origin when "lastEventId" @last_event_id when "source" @source when "ports" @ports else super end end |