Class: Dommy::MediaQueryListEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/dommy/media_query_list.rb

Overview

‘MediaQueryListEvent` — the `change` event payload.

Instance Attribute Summary collapse

Attributes inherited from Event

#type

Instance Method Summary collapse

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) ⇒ MediaQueryListEvent

Returns a new instance of MediaQueryListEvent.



99
100
101
102
103
# File 'lib/dommy/media_query_list.rb', line 99

def initialize(type, init = nil)
  super
  @matches = !!read_init(init, "matches")
  @media = (read_init(init, "media") || "").to_s
end

Instance Attribute Details

#matchesObject (readonly)

Returns the value of attribute matches.



105
106
107
# File 'lib/dommy/media_query_list.rb', line 105

def matches
  @matches
end

#mediaObject (readonly)

Returns the value of attribute media.



105
106
107
# File 'lib/dommy/media_query_list.rb', line 105

def media
  @media
end

Instance Method Details

#__js_get__(key) ⇒ Object



107
108
109
110
111
112
113
114
115
116
# File 'lib/dommy/media_query_list.rb', line 107

def __js_get__(key)
  case key
  when "matches"
    @matches
  when "media"
    @media
  else
    super
  end
end