From f31103ca7108372124bf22df58e1008764ef1059 Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Wed, 16 Dec 2015 17:28:41 +0100 Subject: [PATCH] Adjusted doc according to parameter change for Keyboard Util. Extended description if Keyboard Util. --- docs/pages/javascript-utilities.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/pages/javascript-utilities.md b/docs/pages/javascript-utilities.md index ef8c26a6a..b4e9171d0 100644 --- a/docs/pages/javascript-utilities.md +++ b/docs/pages/javascript-utilities.md @@ -49,7 +49,8 @@ Another quite useful library, `Foundation.Keyboard` has several methods to make Ever wanted a handy list of common keycodes and the keys they represent? Use `Foundation.Keyboard.keys`. This is an object containing key/value pairs of the most frequently used keys in our framework. -Want to manage your own keyboard inputs? No problem! Within your `.on('key**')` callback, call `Foundation.Keyboard.parseKey(event)` to get a string of what key was pressed, e.g. `'TAB'` or `'ALT_X'`. +Want to manage your own keyboard inputs? No problem! Within your `.on('key**')` callback, call `Foundation.Keyboard.parseKey(event)` to get a string of what key was pressed, e.g. `'TAB'` or `'ALT_X'`. +You can also use this function outside of the Foundation components in your own JavaScript code. What if you want to know if there's focusable elements somewhere on a page? Instead of writing that function and selector yourself, just use: ```js @@ -62,13 +63,15 @@ Foundation.Keyboard.register('pluginName', { 'TAB': 'next' }); ...//in event callback -// `this` refers to the current plugin instance -Foundation.Keyboard.handleKey(event, this, { +Foundation.Keyboard.handleKey(event, 'pluginName', { next: function(){ //do stuff } }); ``` +There are also the functions `handled` and `unhandled` where you can place any code that shall always be executed after the key event has been handled or not. + +If you want to use your own key bindings, you can simply call the `Foundation.Keyboard.register` function even after Foundation has been initialized. ## MediaQuery `js/foundation.util.mediaQuery.js` -- 2.47.2