Sha256: 05933cdfbbf27bb9042120135eabee2fdfad6c506f3604be8a28107a158bbdac
Contents?: true
Size: 849 Bytes
Versions: 1
Compression:
Stored size: 849 Bytes
Contents
module Browser; module DOM; class Event class DeviceMotion < Event def self.supported? not $$[:DeviceMotionEvent].nil? end Acceleration = Struct.new(:x, :y, :z) class Definition < Definition def acceleration=(value) `#@native.acceleration = #{value.to_n}` end def acceleration_with_gravity=(value) `#@native.accelerationIncludingGravity = #{value.to_n}` end def rotation=(value) `#@native.rotationRate = #{value}` end def interval=(value) `#@native.interval = #{value}` end end def self.create(name, &block) new(`new DeviceMotionEvent(#{name}, #{Definition.new(&block)})`) end alias_native :acceleration alias_native :acceleration_with_gravity, :accelerationIncludingGravity alias_native :rotation, :rotationRate alias_native :interval end end; end; end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-browser-0.1.0.beta1 | opal/browser/dom/event/device_motion.rb |