Changes to fix failed jshint test related to Key Binding API

This commit is contained in:
Greg Denehy 2017-04-30 19:42:45 +09:30
parent e16508477a
commit b86b667d25

View file

@ -1234,14 +1234,14 @@
callback: callback, callback: callback,
key: binding.key, key: binding.key,
description: binding.description description: binding.description
} };
} }
else { else {
registeredKeyBindings[binding] = { registeredKeyBindings[binding] = {
callback: callback, callback: callback,
key: null, key: null,
description: null description: null
} };
} }
} }
@ -4386,15 +4386,15 @@
// Check if this binding matches the pressed key // Check if this binding matches the pressed key
if( parseInt( key, 10 ) === event.keyCode ) { if( parseInt( key, 10 ) === event.keyCode ) {
var value = registeredKeyBindings[ key ].callback; var action = registeredKeyBindings[ key ].callback;
// Callback function // Callback function
if( typeof value === 'function' ) { if( typeof action === 'function' ) {
value.apply( null, [ event ] ); action.apply( null, [ event ] );
} }
// String shortcuts to reveal.js API // String shortcuts to reveal.js API
else if( typeof value === 'string' && typeof Reveal[ value ] === 'function' ) { else if( typeof action === 'string' && typeof Reveal[ action ] === 'function' ) {
Reveal[ value ].call(); Reveal[ action ].call();
} }
triggered = true; triggered = true;