Class: Browser::Event::Keyboard
- Inherits:
-
UI
show all
- Defined in:
- opal/browser/event/keyboard.rb
Defined Under Namespace
Classes: Definition
Instance Attribute Summary
#callback, #on
Class Method Summary
collapse
Instance Method Summary
collapse
aliases, #arguments, #arguments=, class_for, create, #initialize, #name, name_for, new, #off, #prevent, #prevented?, #stop, #stop!, #stopped?, #target
Constructor Details
This class inherits a constructor from Browser::Event
Class Method Details
.construct(name, desc) ⇒ Object
47
48
49
|
# File 'opal/browser/event/keyboard.rb', line 47
def self.construct(name, desc)
`new KeyboardEvent(#{name}, #{desc})`
end
|
.supported? ⇒ Boolean
4
5
6
|
# File 'opal/browser/event/keyboard.rb', line 4
def self.supported?
Browser.supports? 'Event.Keyboard'
end
|
Instance Method Details
96
97
98
|
# File 'opal/browser/event/keyboard.rb', line 96
def char
`#@native.char || #@native.charCode || #{code ? code.chr : nil}`
end
|
92
93
94
|
# File 'opal/browser/event/keyboard.rb', line 92
def code
`#@native.keyCode || #@native.which || nil`
end
|
#down? ⇒ Boolean
102
103
104
|
# File 'opal/browser/event/keyboard.rb', line 102
def down?
name.downcase == 'keydown'
end
|
#key ⇒ Object
Also known as:
to_i
88
89
90
|
# File 'opal/browser/event/keyboard.rb', line 88
def key
`#@native.key || #@native.keyIdentifier || nil`
end
|
#press? ⇒ Boolean
106
107
108
|
# File 'opal/browser/event/keyboard.rb', line 106
def press?
name.downcase == 'keypress'
end
|
#up? ⇒ Boolean
110
111
112
|
# File 'opal/browser/event/keyboard.rb', line 110
def up?
name.downcase == 'keyup'
end
|