Class: Dommy::BeforeUnloadEvent
Overview
‘BeforeUnloadEvent` — `beforeunload` event. Setting `return_value` to a non-empty string (or calling `preventDefault`) signals the browser to prompt the user before navigating away.
Constant Summary
Constants inherited from Event
Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE
Instance Attribute Summary collapse
-
#return_value ⇒ Object
Returns the value of attribute return_value.
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
- #__js_set__(key, value) ⇒ Object
-
#initialize(type = "beforeunload", init = nil) ⇒ BeforeUnloadEvent
constructor
A new instance of BeforeUnloadEvent.
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__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?
Methods included from Dommy::Bridge::Methods
Constructor Details
#initialize(type = "beforeunload", init = nil) ⇒ BeforeUnloadEvent
Returns a new instance of BeforeUnloadEvent.
961 962 963 964 |
# File 'lib/dommy/event.rb', line 961 def initialize(type = "beforeunload", init = nil) super @return_value = (read_init(init, "returnValue") || "").to_s end |
Instance Attribute Details
#return_value ⇒ Object
Returns the value of attribute return_value.
966 967 968 |
# File 'lib/dommy/event.rb', line 966 def return_value @return_value end |
Instance Method Details
#__js_get__(key) ⇒ Object
968 969 970 971 972 973 974 975 |
# File 'lib/dommy/event.rb', line 968 def __js_get__(key) case key when "returnValue" @return_value else super end end |
#__js_set__(key, value) ⇒ Object
977 978 979 980 981 982 983 984 |
# File 'lib/dommy/event.rb', line 977 def __js_set__(key, value) case key when "returnValue" @return_value = value.to_s else super end end |