Sha256: 7478b379668334f4eb99c48859667ccecb1e19c59301b92241b487bf7ddce786

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

module Browser; class Event

class Progress < Event
  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

2 entries across 2 versions & 2 rubygems

Version Path
diamonds-0.1.5 lib/diamonds/opal/browser/event/progress.rb
opal-browser-0.2.0 opal/browser/event/progress.rb