* Removes no longer active keys and fires the on key up callbacks for associated active bindings. * @param event
(event)
| 230 | * @param event |
| 231 | */ |
| 232 | function pruneActiveKeyBindings(event) { |
| 233 | var bindingStack = queryActiveBindings(); |
| 234 | var output; |
| 235 | |
| 236 | //loop through the active combos |
| 237 | for(var bindingCombo in activeBindings) { |
| 238 | if(activeBindings.hasOwnProperty(bindingCombo)) { |
| 239 | var binding = activeBindings[bindingCombo], |
| 240 | active = false; |
| 241 | |
| 242 | //loop thorugh the active bindings |
| 243 | for(var bindingIndex = 0; bindingIndex < bindingStack.length; bindingIndex += 1) { |
| 244 | var activeCombo = bindingStack[bindingIndex].keyCombo; |
| 245 | |
| 246 | //check to see if the combo is still active |
| 247 | if(activeCombo === bindingCombo) { |
| 248 | active = true; |
| 249 | break; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | //if the combo is no longer active then fire its end callback and remove it |
| 254 | if(!active) { |
| 255 | |
| 256 | if(typeof binding.endCallback === "function") { |
| 257 | if(!binding.endCallback(event, binding.keys, binding.keyCombo)) { |
| 258 | output = false |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | delete activeBindings[bindingCombo]; |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | return output; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * Binds a on key down and on key up callback to a key or key combo. Accepts a string containing the name of each |
no test coverage detected