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_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.
522 523 524 525 |
# File 'lib/dommy/event.rb', line 522 def initialize(type, init = nil) super @state = read_init(init, "state") end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
520 521 522 |
# File 'lib/dommy/event.rb', line 520 def state @state end |
Instance Method Details
#__js_get__(key) ⇒ Object
527 528 529 530 531 |
# File 'lib/dommy/event.rb', line 527 def __js_get__(key) return @state if key == "state" super end |