Sha256: b01fabb6bd45b2a0aefc307b35f5fe5ad6b97a34dc499b19fd62cc4e37eb8eea

Contents?: true

Size: 996 Bytes

Versions: 5

Compression:

Stored size: 996 Bytes

Contents

module Browser; class Event

class Progress < Event
  handles 'progress', 'load', 'loadend', 'loadstart'

  def self.supported?
    Browser.supports? 'Event.Progress'
  end

  class Definition < Definition
    def computable=(value)
      `#@native.computableLength = #{value}`
    end

    def loaded=(value)
      `#@native.loaded = #{value}`
    end

    def total=(value)
      `#@native.total = #{value}`
    end
  end

  if Browser.supports? 'Event.constructor'
    def self.construct(name, desc)
      `new ProgressEvent(#{name}, #{desc})`
    end
  elsif Browser.supports? 'Event.create'
    def self.construct(name, desc)
      %x{
        var event = document.createEvent("ProgressEvent");
            event.initProgressEvent(name, desc.bubbles, desc.cancelable,
              desc.computable, desc.loaded, desc.total);

        return event;
      }
    end
  end if supported?

  alias_native :computable?, :computableLength
  alias_native :loaded
  alias_native :total
end

end; end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
atome-opal-browser-0.3.9.5 opal/browser/event/progress.rb
opal-browser-0.3.3 opal/browser/event/progress.rb
opal-browser-0.3.2 opal/browser/event/progress.rb
opal-browser-0.3.1 opal/browser/event/progress.rb
opal-browser-0.3.0 opal/browser/event/progress.rb