Sha256: 6cdf24d79e0b9677d30830a4f436dbe7716afeb275244476c310ab5f113e8b71

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

# Wraps native jQuery event objects.
class Event < `$.Event`
  def [](name)
    `#{self}[name]`
  end

  def current_target
    `$(#{self}.currentTarget)`
  end

  alias_native :default_prevented?, :isDefaultPrevented

  def kill
    stop_propagation
    prevent_default
  end

  alias_native :prevent_default, :preventDefault

  def page_x
    `#{self}.pageX`
  end

  def page_y
    `#{self}.pageY`
  end

  alias_native :propagation_stopped?, :propagationStopped

  alias_native :stop_propagation, :stopPropagation

  alias_native :stop_immediate_propagation, :stopImmediatePropagation

  def target
    `$(#{self}.target)`
  end

  def touch_x
    `#{self}.originalEvent.touches[0].pageX`
  end

  def touch_y
    `#{self}.originalEvent.touches[0].pageY`
  end

  def type
    `#{self}.type`
  end

  def which
    `#{self}.which`
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-jquery-0.0.5 lib/assets/javascripts/opal/jquery/event.rb