Class: Dommy::ProgressEvent
Overview
‘ProgressEvent` — fired during long-running operations (XHR, fetch upload/download progress). Carries `loaded` / `total` / `lengthComputable`.
Instance Attribute Summary
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ ProgressEvent
constructor
A new instance of ProgressEvent.
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) ⇒ ProgressEvent
Returns a new instance of ProgressEvent.
523 524 525 526 527 528 |
# File 'lib/dommy/event.rb', line 523 def initialize(type, init = nil) super @loaded = (read_init(init, "loaded") || 0).to_i @total = (read_init(init, "total") || 0).to_i @length_computable = !!read_init(init, "lengthComputable") end |
Instance Method Details
#__js_get__(key) ⇒ Object
530 531 532 533 534 535 536 537 538 539 540 541 |
# File 'lib/dommy/event.rb', line 530 def __js_get__(key) case key when "loaded" @loaded when "total" @total when "lengthComputable" @length_computable else super end end |