Sha256: 95556ce74003b01b3a9d1d76642a1637c331e3219c9c0dcab6bf23d4a30a9793

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

# backtick_javascript: true

module Browser; class Event

class UI < Event
  def self.supported?
    Browser.supports? 'Event.UI'
  end

  class Definition < Definition
    alias_native :detail=
    alias_native :view=
  end

  if Browser.supports? 'Event.constructor'
    def self.construct(name, desc)
      `new UIEvent(#{name}, #{desc})`
    end
  elsif Browser.supports? 'Event.create'
    def self.construct(name, desc)
      %x{
        var event = document.createEvent("UIEvent");
            event.initUIEvent(name, desc.bubbles, desc.cancelable,
              desc.view || window, desc.detail || 0);

        return event;
      }
    end
  end if supported?

  alias_native :detail
  alias_native :view
end

end; end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-browser-0.3.5 opal/browser/event/ui.rb
opal-browser-0.3.4 opal/browser/event/ui.rb