Class: Dommy::PopStateEvent
Overview
PopStateEvent — fired on history back/forward. Exposes the history entry's
serialized state via event.state (the spec property; framework routers like
Turbo read event.state.turbo to recognise their own navigations and restore
the cached page). A plain Event subclass per spec — NOT a CustomEvent, so it
has no detail and instanceof CustomEvent is false.
Constant Summary
Constants inherited from Event
Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ PopStateEvent
constructor
A new instance of PopStateEvent.
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) ⇒ PopStateEvent
Returns a new instance of PopStateEvent.
708 709 710 711 |
# File 'lib/dommy/event.rb', line 708 def initialize(type, init = nil) super @state = read_init(init, "state") end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
706 707 708 |
# File 'lib/dommy/event.rb', line 706 def state @state end |
Instance Method Details
#__js_get__(key) ⇒ Object
713 714 715 716 717 |
# File 'lib/dommy/event.rb', line 713 def __js_get__(key) return @state if key == "state" super end |