Method: Event#code

Defined in:
lib/source/redshift/event.rb

#codeObject

call-seq:

evnt.code -> integer or nil

If evnt involved a keystroke, returns the ASCII code of the key pressed, otherwise returns nil.

Document['#example'].listen(:keypress) {|element, event| puts event.code }

typing “testn” into textarea ‘#example produces:

116
101
115
116
13


134
135
136
# File 'lib/source/redshift/event.rb', line 134

def code
  `this.__code__ || nil`
end