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_run_passive__, #__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.
1371 1372 1373 1374 |
# File 'lib/dommy/event.rb', line 1371 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.
1376 1377 1378 |
# File 'lib/dommy/event.rb', line 1376 def return_value @return_value end |
Instance Method Details
#__js_get__(key) ⇒ Object
1378 1379 1380 1381 1382 1383 1384 1385 |
# File 'lib/dommy/event.rb', line 1378 def __js_get__(key) case key when "returnValue" @return_value else super end end |
#__js_set__(key, value) ⇒ Object
1387 1388 1389 1390 1391 1392 1393 1394 |
# File 'lib/dommy/event.rb', line 1387 def __js_set__(key, value) case key when "returnValue" @return_value = value.to_s else super end end |