some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-08-03 20:45:42 +03:00
parent 9b88fdfbea
commit 3d81db1bc2
2 changed files with 20 additions and 3 deletions

View File

@ -2295,7 +2295,6 @@ var WidgetTestActions = actions.Actions({
.attr(attrs)) .attr(attrs))
}], }],
// action constructor for testing... // action constructor for testing...
makeAction: ['- Test/', makeAction: ['- Test/',
function(name){ function(name){

View File

@ -491,6 +491,21 @@ var KeyboardPrototype = {
// XXX is this needed??? // XXX is this needed???
//context: null, //context: null,
// string handler parser...
//
// Return format:
// {
// action: <str>,
// arguments: <array>,
// doc: <str> || null,
// no_default: <bool>,
// stop_propagation: <bool>,
// }
//
parseStringHandler: parseActionCall,
// utils... // utils...
event2key: KeyboardClassPrototype.event2key, event2key: KeyboardClassPrototype.event2key,
key2code: KeyboardClassPrototype.key2code, key2code: KeyboardClassPrototype.key2code,
@ -1041,6 +1056,9 @@ KeyboardWithCSSModes.prototype.__proto__ = Keyboard.prototype
// NOTE: if .capslock is false means that either it is not on or // NOTE: if .capslock is false means that either it is not on or
// undetectable... // undetectable...
// NOTE: before any key is pressed the .capslock is set to undefined // NOTE: before any key is pressed the .capslock is set to undefined
//
// XXX not sure if handler calling mechanics should be outside of the
// Keyboard object...
var makeKeyboardHandler = var makeKeyboardHandler =
module.makeKeyboardHandler = module.makeKeyboardHandler =
function makeKeyboardHandler(keyboard, unhandled, actions){ function makeKeyboardHandler(keyboard, unhandled, actions){
@ -1079,8 +1097,8 @@ function makeKeyboardHandler(keyboard, unhandled, actions){
res = handler.call(actions) res = handler.call(actions)
// action call syntax... // action call syntax...
} else { } else if(kb.parseStringHandler){
var h = parseActionCall(handler) var h = kb.parseStringHandler(handler)
if(h && h.action in actions){ if(h && h.action in actions){
did_handling = true did_handling = true