Sha256: aea0bb017749bb0ad053ff6d710fc181204f75e4d1e1ebd7be8c126883d6e018

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

module Browser; class Event

class Composition < UI
  handles 'compositionend', 'compositionstart', 'compositionupdate'

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

  class Definition < UI::Definition
    def data=(value)
      `#@native.data = #{value}`
    end

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

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

        return event;
      }
    end
  end if supported?

  alias_native :data
  alias_native :locale

  def start?
    name.downcase == 'compositionstart'
  end

  def update?
    name.downcase == 'compositionupdate'
  end

  def end?
    name.downcase == 'compositionend'
  end
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/composition.rb
opal-browser-0.3.3 opal/browser/event/composition.rb
opal-browser-0.3.2 opal/browser/event/composition.rb
opal-browser-0.3.1 opal/browser/event/composition.rb
opal-browser-0.3.0 opal/browser/event/composition.rb