Class: Dommy::ProgressEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/dommy/event.rb

Overview

ProgressEvent — fired during long-running operations (XHR, fetch upload/download progress). Carries loaded / total / lengthComputable.

Constant Summary

Constants inherited from Event

Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE

Instance Attribute Summary

Attributes inherited from Event

#type

Instance Method Summary collapse

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

included

Constructor Details

#initialize(type, init = nil) ⇒ ProgressEvent

Returns a new instance of ProgressEvent.



1100
1101
1102
1103
1104
1105
# File 'lib/dommy/event.rb', line 1100

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



1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/dommy/event.rb', line 1107

def __js_get__(key)
  case key
  when "loaded"
    @loaded
  when "total"
    @total
  when "lengthComputable"
    @length_computable
  else
    super
  end
end