UNPKG

crossbrowdy

Version:

A Multimedia JavaScript framework to create real cross-platform and hybrid game engines, games, emulators, multimedia libraries and apps.

2,319 lines (767 loc) 89.2 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>CrossBrowdy API documentation [printable] Namespace: CB_Keyboard</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.yeti.css"> </head> <body style="min-width:800px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">CrossBrowdy API documentation [printable]</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a> <ul class="dropdown-menu inline"> <li><a href="CB_Arrays.html">CB_Arrays</a></li><li><a href="CB_AudioDetector.html">CB_AudioDetector</a></li><li><a href="CB_Client.html">CB_Client</a></li><li><a href="CB_Collisions.html">CB_Collisions</a></li><li><a href="CB_Configuration.html">CB_Configuration</a></li><li><a href="CB_Configuration.CrossBase.html">CB_Configuration.CrossBase</a></li><li><a href="CB_Configuration.CrossBrowdy.html">CB_Configuration.CrossBrowdy</a></li><li><a href="CB_Controllers.html">CB_Controllers</a></li><li><a href="CB_Controllers_Proprietary.html">CB_Controllers_Proprietary</a></li><li><a href="CB_Controllers_Proprietary.WII.html">CB_Controllers_Proprietary.WII</a></li><li><a href="CB_Controllers_Proprietary.WII_U.html">CB_Controllers_Proprietary.WII_U</a></li><li><a href="CB_Device.html">CB_Device</a></li><li><a href="CB_Device.AmbientLight.html">CB_Device.AmbientLight</a></li><li><a href="CB_Device.Battery.html">CB_Device.Battery</a></li><li><a href="CB_Device.Location.html">CB_Device.Location</a></li><li><a href="CB_Device.Motion.html">CB_Device.Motion</a></li><li><a href="CB_Device.Orientation.html">CB_Device.Orientation</a></li><li><a href="CB_Device.Proximity.html">CB_Device.Proximity</a></li><li><a href="CB_Device.Vibration.html">CB_Device.Vibration</a></li><li><a href="CB_Elements.html">CB_Elements</a></li><li><a href="CB_Events.html">CB_Events</a></li><li><a href="CB_Keyboard.html">CB_Keyboard</a></li><li><a href="CB_Keyboard.chars.html">CB_Keyboard.chars</a></li><li><a href="CB_Keyboard.extended.html">CB_Keyboard.extended</a></li><li><a href="CB_Keyboard.keys.html">CB_Keyboard.keys</a></li><li><a href="CB_Modules.html">CB_Modules</a></li><li><a href="CB_Mouse.html">CB_Mouse</a></li><li><a href="CB_Mouse.CursorImage.html">CB_Mouse.CursorImage</a></li><li><a href="CB_Net.html">CB_Net</a></li><li><a href="CB_Net.Fetch.html">CB_Net.Fetch</a></li><li><a href="CB_Net.REST.html">CB_Net.REST</a></li><li><a href="CB_Net.Sockets.html">CB_Net.Sockets</a></li><li><a href="CB_Net.Sockets.SockJS.html">CB_Net.Sockets.SockJS</a></li><li><a href="CB_Net.XHR.html">CB_Net.XHR</a></li><li><a href="CB_Pointer.html">CB_Pointer</a></li><li><a href="CB_Screen.html">CB_Screen</a></li><li><a href="CB_Speaker.html">CB_Speaker</a></li><li><a href="CB_Touch.html">CB_Touch</a></li><li><a href="CB_baseSymbols.html">CB_baseSymbols</a></li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu inline"> <li><a href="CB_AudioFile.html">CB_AudioFile</a></li><li><a href="CB_AudioFileCache.html">CB_AudioFileCache</a></li><li><a href="CB_AudioFileSprites.html">CB_AudioFileSprites</a></li><li><a href="CB_AudioFileSpritesPool.html">CB_AudioFileSpritesPool</a></li><li><a href="CB_AudioFile_API.AAPI.html">CB_AudioFile_API.AAPI</a></li><li><a href="CB_AudioFile_API.ACMP.html">CB_AudioFile_API.ACMP</a></li><li><a href="CB_AudioFile_API.SM2.html">CB_AudioFile_API.SM2</a></li><li><a href="CB_AudioFile_API.WAAPI.html">CB_AudioFile_API.WAAPI</a></li><li><a href="CB_Canvas.html">CB_Canvas</a></li><li><a href="CB_GraphicSprites.html">CB_GraphicSprites</a></li><li><a href="CB_GraphicSpritesScene.html">CB_GraphicSpritesScene</a></li> </ul> </li> <li class="dropdown"> <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a> <ul class="dropdown-menu inline"> <li><a href="global.html#CB_BASE_NAME">CB_BASE_NAME</a></li><li><a href="global.html#CB_CREDITS_DEFAULT">CB_CREDITS_DEFAULT</a></li><li><a href="global.html#CB_NAME">CB_NAME</a></li><li><a href="global.html#CB_OPTIONS">CB_OPTIONS</a></li><li><a href="global.html#CB_VERSION">CB_VERSION</a></li><li><a href="global.html#CB_addCredits">CB_addCredits</a></li><li><a href="global.html#CB_baseToBase">CB_baseToBase</a></li><li><a href="global.html#CB_baseToInt">CB_baseToInt</a></li><li><a href="global.html#CB_br2nl">CB_br2nl</a></li><li><a href="global.html#CB_brToNl">CB_brToNl</a></li><li><a href="global.html#CB_combineArraysOrObjects">CB_combineArraysOrObjects</a></li><li><a href="global.html#CB_combineAutomatically">CB_combineAutomatically</a></li><li><a href="global.html#CB_combineJSON">CB_combineJSON</a></li><li><a href="global.html#CB_combineURIParameters">CB_combineURIParameters</a></li><li><a href="global.html#CB_combineURLParameters">CB_combineURLParameters</a></li><li><a href="global.html#CB_console">CB_console</a></li><li><a href="global.html#CB_copyObject">CB_copyObject</a></li><li><a href="global.html#CB_countDecimalDigits">CB_countDecimalDigits</a></li><li><a href="global.html#CB_countDecimalPart">CB_countDecimalPart</a></li><li><a href="global.html#CB_countDecimals">CB_countDecimals</a></li><li><a href="global.html#CB_countIntegerDigits">CB_countIntegerDigits</a></li><li><a href="global.html#CB_countIntegerPart">CB_countIntegerPart</a></li><li><a href="global.html#CB_credits">CB_credits</a></li><li><a href="global.html#CB_forEach">CB_forEach</a></li><li><a href="global.html#CB_forceString">CB_forceString</a></li><li><a href="global.html#CB_getBase64StringObject">CB_getBase64StringObject</a></li><li><a href="global.html#CB_getCookie">CB_getCookie</a></li><li><a href="global.html#CB_getDatum">CB_getDatum</a></li><li><a href="global.html#CB_getJSONPropertyValue">CB_getJSONPropertyValue</a></li><li><a href="global.html#CB_getLZStringObject">CB_getLZStringObject</a></li><li><a href="global.html#CB_getValueIndex">CB_getValueIndex</a></li><li><a href="global.html#CB_getValuePath">CB_getValuePath</a></li><li><a href="global.html#CB_includeJSFile">CB_includeJSFile</a></li><li><a href="global.html#CB_indexOf">CB_indexOf</a></li><li><a href="global.html#CB_init">CB_init</a></li><li><a href="global.html#CB_intToBase">CB_intToBase</a></li><li><a href="global.html#CB_isArray">CB_isArray</a></li><li><a href="global.html#CB_isEmail">CB_isEmail</a></li><li><a href="global.html#CB_isFileLocal">CB_isFileLocal</a></li><li><a href="global.html#CB_isString">CB_isString</a></li><li><a href="global.html#CB_lastIndexOf">CB_lastIndexOf</a></li><li><a href="global.html#CB_ltrim">CB_ltrim</a></li><li><a href="global.html#CB_nl2br">CB_nl2br</a></li><li><a href="global.html#CB_nlToBr">CB_nlToBr</a></li><li><a href="global.html#CB_numberFormat">CB_numberFormat</a></li><li><a href="global.html#CB_numberOfDecimalDigits">CB_numberOfDecimalDigits</a></li><li><a href="global.html#CB_numberOfDecimals">CB_numberOfDecimals</a></li><li><a href="global.html#CB_numberOfIntegerDigits">CB_numberOfIntegerDigits</a></li><li><a href="global.html#CB_parseJSON">CB_parseJSON</a></li><li><a href="global.html#CB_parseString">CB_parseString</a></li><li><a href="global.html#CB_regularExpressionString">CB_regularExpressionString</a></li><li><a href="global.html#CB_renderString">CB_renderString</a></li><li><a href="global.html#CB_replaceAll">CB_replaceAll</a></li><li><a href="global.html#CB_rtrim">CB_rtrim</a></li><li><a href="global.html#CB_scriptPath">CB_scriptPath</a></li><li><a href="global.html#CB_scriptPathCalculate">CB_scriptPathCalculate</a></li><li><a href="global.html#CB_setCookie">CB_setCookie</a></li><li><a href="global.html#CB_setDatum">CB_setDatum</a></li><li><a href="global.html#CB_sizeOf">CB_sizeOf</a></li><li><a href="global.html#CB_sizeof">CB_sizeof</a></li><li><a href="global.html#CB_stringifyJSON">CB_stringifyJSON</a></li><li><a href="global.html#CB_symmetricCall">CB_symmetricCall</a></li><li><a href="global.html#CB_symmetricCallClear">CB_symmetricCallClear</a></li><li><a href="global.html#CB_this">CB_this</a></li><li><a href="global.html#CB_trim">CB_trim</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content" style="width:100%;"> <div class="row" style="width:100%;"> <div class="col-md-8" style="width:85%;"> <div id="main"> <h1 class="page-title">Namespace: CB_Keyboard</h1> <section> <header> <h2> CB_Keyboard </h2> </header> <article> <div class="container-overview"> <div class="description"><p>Static class to manage the keyboard and other input devices that generate key codes. It will return itself if it is tried to be instantiated.</p></div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-11">line 11</a> </li> </ul> </dd> </dl> </div> <h3 class="subsection-title">Namespaces</h3> <dl> <dt><a href="namespaces.html#CB_Keyboard.chars"><a href="CB_Keyboard.chars.html">chars</a></a></dt> <dd></dd> <dt><a href="namespaces.html#CB_Keyboard.extended"><a href="CB_Keyboard.extended.html">extended</a></a></dt> <dd></dd> <dt><a href="namespaces.html#CB_Keyboard.keys"><a href="CB_Keyboard.keys.html">keys</a></a></dt> <dd></dd> </dl> <h3 class="subsection-title">Members</h3> <dl> <hr> <dt class="name" id=".keysDown"> <h4 id=".keysDown"><span class="type-signature">&lt;static, readonly> </span>keysDown<span class="type-signature"> :Object</span></h4> </dt> <dd> <div class="description"> <p>Object that will store the status for each key detected, using the key code as index and a boolean as their value (true when down or false when released).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <dl class="details"> <dt class="tag-default method-doc-label method-doc-details-label">Default Value:</dt> <dd class="tag-default"> <ul class="dummy"> <li>{}</li> </ul> </dd> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-26">line 26</a> </li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id=".keysPressed"> <h4 id=".keysPressed"><span class="type-signature">&lt;static, readonly> </span>keysPressed<span class="type-signature"> :array</span></h4> </dt> <dd> <div class="description"> <p>Array with the codes of the keys pressed recently (it will be cleared after the chosen milliseconds set with the <a href="CB_Keyboard.html#.setKeysPressedExpiration"><code>CB_Keyboard.setKeysPressedExpiration</code></a> function).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">array</span> </li> </ul> <dl class="details"> <dt class="tag-default method-doc-label method-doc-details-label">Default Value:</dt> <dd class="tag-default"> <ul class="dummy"> <li>[]</li> </ul> </dd> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-36">line 36</a> </li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id=".typedString"> <h4 id=".typedString"><span class="type-signature">&lt;static, readonly> </span>typedString<span class="type-signature"> :string</span></h4> </dt> <dd> <div class="description"> <p>Stores the string typed recently (it will be cleared after the chosen milliseconds set with the <a href="CB_Keyboard.html#.setTypedStringExpiration"><code>CB_Keyboard.setTypedStringExpiration</code></a> function).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-58">line 58</a> </li> </ul> </dd> </dl> </dd> <hr> <dt class="name" id=".typedStringCodes"> <h4 id=".typedStringCodes"><span class="type-signature">&lt;static, readonly> </span>typedStringCodes<span class="type-signature"> :array</span></h4> </dt> <dd> <div class="description"> <p>Array with the codes of the string typed recently (it will be cleared after the chosen milliseconds set with the <a href="CB_Keyboard.html#.setTypedStringExpiration"><code>CB_Keyboard.setTypedStringExpiration</code></a> function).</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">array</span> </li> </ul> <dl class="details"> <dt class="tag-default method-doc-label method-doc-details-label">Default Value:</dt> <dd class="tag-default"> <ul class="dummy"> <li>[]</li> </ul> </dd> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-48">line 48</a> </li> </ul> </dd> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id=".clearKeysDown"><span class="type-signature">&lt;static> </span>clearKeysDown<span class="signature">(keepPressed)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Clears (empties totally or partially) the <a href="CB_Keyboard.html#.keysDown"><code>CB_Keyboard.keysDown</code></a> object which contains the detected keys pressed or released.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>keepPressed</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">boolean</span> </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p>If set to true, it will keep the pressed keys.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3207">line 3207</a> </li> </ul> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".clearKeysPressed"><span class="type-signature">&lt;static> </span>clearKeysPressed<span class="signature">(keepPressed)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Clears (empties totally or partially) the <a href="CB_Keyboard.html#.keysPressed"><code>CB_Keyboard.keysPressed</code></a> array which contains the key codes pressed recently.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>keepPressed</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">boolean</span> </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p>If set to true, it will keep the pressed keys (taken from the <a href="CB_Keyboard.html#.keysDown"><code>CB_Keyboard.keysDown</code></a> object).</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3315">line 3315</a> </li> </ul> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".clearTypedString"><span class="type-signature">&lt;static> </span>clearTypedString<span class="signature">(keepPressed)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Clears (empties totally or partially) the <a href="CB_Keyboard.html#.typedString"><code>CB_Keyboard.typedString</code></a> string and the <a href="CB_Keyboard.html#.typedStringCodes"><code>CB_Keyboard.typedStringCodes</code></a> array.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>keepPressed</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">boolean</span> </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p>If set to true, it will keep the values belonging to the currently-pressed keys (taken from the <a href="CB_Keyboard.html#.keysDown"><code>CB_Keyboard.keysDown</code></a> object).</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3434">line 3434</a> </li> </ul> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getKeyCode"><span class="type-signature">&lt;static> </span>getKeyCode<span class="signature">(e [, avoidNormalize])</span><span class="type-signature"> &rarr; {integer}</span></h4> </dt> <dd> <div class="description"> <p>Returns the key code that is contained in the given <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent">keyboard event</a>.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th style="width:12%; min-width:110px;">Argument</th> <th style="width:12%; min-width:110px;">Default</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>e</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">Event</span> </td> <td class="attributes" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> </td> <td class="default" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent">Keyboard event</a> object.</p></td> </tr> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>avoidNormalize</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">boolean</span> </td> <td class="attributes" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> &lt;optional><br> </td> <td class="default" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> false </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p>If it is not set to true, it will call the <a href="CB_Events.html#.normalize"><code>CB_Events.normalize</code></a> function internally before.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3159">line 3159</a> </li> </ul> </dd> <dt class="tag-todo method-doc-label method-doc-details-label">To Do:</dt> <dd class="tag-todo"> <ul> <li>Have in mind that <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode">keyCode</a> is deprecated.</li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the key code.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">integer</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getKeysDown"><span class="type-signature">&lt;static> </span>getKeysDown<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> </dt> <dd> <div class="description"> <p>Returns the <a href="CB_Keyboard.html#.keysDown"><code>CB_Keyboard.keysDown</code></a> object which contains the detected keys pressed or released.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3227">line 3227</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the <a href="CB_Keyboard.html#.keysDown"><code>CB_Keyboard.keysDown</code></a> object.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getKeysPressed"><span class="type-signature">&lt;static> </span>getKeysPressed<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4> </dt> <dd> <div class="description"> <p>Returns the <a href="CB_Keyboard.html#.keysPressed"><code>CB_Keyboard.keysPressed</code></a> array which contains the key codes pressed recently (it will be cleared after the chosen milliseconds set with the <a href="CB_Keyboard.html#.setKeysPressedExpiration"><code>CB_Keyboard.setKeysPressedExpiration</code></a> function).</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3338">line 3338</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the <a href="CB_Keyboard.html#.keysPressed"><code>CB_Keyboard.keysPressed</code></a> array.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getKeysPressedExpiration"><span class="type-signature">&lt;static> </span>getKeysPressedExpiration<span class="signature">()</span><span class="type-signature"> &rarr; {integer}</span></h4> </dt> <dd> <div class="description"> <p>Returns the milliseconds after which the <a href="CB_Keyboard.html#.keysPressed"><code>CB_Keyboard.keysPressed</code></a> array is always cleared (emptied). The time always starts counting from zero again when a key is pressed (<a href="https://developer.mozilla.org/en-US/docs/Web/Events/keydown">onKeyDown</a> event is fired).<br> To define this amount of time, the <a href="CB_Keyboard.html#.setKeysPressedExpiration"><code>CB_Keyboard.setKeysPressedExpiration</code></a> method must be used.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3368">line 3368</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the milliseconds of expiration defined for the <a href="CB_Keyboard.html#.keysPressed"><code>CB_Keyboard.keysPressed</code></a> array.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">integer</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getTypedString"><span class="type-signature">&lt;static> </span>getTypedString<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> </dt> <dd> <div class="description"> <p>Returns the <a href="CB_Keyboard.html#.typedString"><code>CB_Keyboard.typedString</code></a> string which contains the string typed recently (it will be cleared after the chosen milliseconds set with the <a href="CB_Keyboard.html#.setTypedStringExpiration"><code>CB_Keyboard.setTypedStringExpiration</code></a> function).</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3485">line 3485</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the <a href="CB_Keyboard.html#.typedString"><code>CB_Keyboard.typedString</code></a> string.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getTypedStringCodes"><span class="type-signature">&lt;static> </span>getTypedStringCodes<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4> </dt> <dd> <div class="description"> <p>Returns the <a href="CB_Keyboard.html#.typedStringCodes"><code>CB_Keyboard.typedStringCodes</code></a> array which contains the key codes pressed that belongs to the string typed recently (it will be cleared after the chosen milliseconds set with the <a href="CB_Keyboard.html#.setTypedStringExpiration"><code>CB_Keyboard.setTypedStringExpiration</code></a> function).</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3496">line 3496</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the <a href="CB_Keyboard.html#.typedStringCodes"><code>CB_Keyboard.typedStringCodes</code></a> array.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".getTypedStringExpiration"><span class="type-signature">&lt;static> </span>getTypedStringExpiration<span class="signature">()</span><span class="type-signature"> &rarr; {integer}</span></h4> </dt> <dd> <div class="description"> <p>Returns the milliseconds after which the <a href="CB_Keyboard.html#.typedString"><code>CB_Keyboard.typedString</code></a> string and the <a href="CB_Keyboard.html#.typedStringCodes"><code>CB_Keyboard.typedStringCodes</code></a> array are always cleared (emptied). The time always starts counting from zero again when a key is pressed (<a href="https://developer.mozilla.org/en-US/docs/Web/Events/keypress">onKeyPress</a> event is fired).<br> To define this amount of time, the <a href="CB_Keyboard.html#.setTypedStringExpiration"><code>CB_Keyboard.setTypedStringExpiration</code></a> method must be used.</p> </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3526">line 3526</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the milliseconds of expiration defined for the <a href="CB_Keyboard.html#.typedString"><code>CB_Keyboard.typedString</code></a> string and the <a href="CB_Keyboard.html#.typedStringCodes"><code>CB_Keyboard.typedStringCodes</code></a> array.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">integer</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".isKeyDown"><span class="type-signature">&lt;static> </span>isKeyDown<span class="signature">(keyCodes [, allPressed])</span><span class="type-signature"> &rarr; {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Returns whether the given key codes are being pressed (any of them or all at the same time, depending on the &quot;allPressed&quot; parameter).</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th style="width:12%; min-width:110px;">Argument</th> <th style="width:12%; min-width:110px;">Default</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>keyCodes</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">integer</span> | <span class="param-type">array</span> | <span class="param-type">Object</span> </td> <td class="attributes" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> </td> <td class="default" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p>An integer with the key code or a numeric array with the key codes that we want to check. It can also be an array of arrays, being each element a numeric array with the key codes that we want to check. Although not recommended (for performance purposes), this parameter can also support an object whose indexes are the keycodes (it will be converted to a numeric array internally).</p></td> </tr> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>allPressed</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">boolean</span> </td> <td class="attributes" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> &lt;optional><br> </td> <td class="default" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> false </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p>If set true, the function will only return true in the case that all given key codes are currently being pressed. Otherwise, if set to false, the function will return true in the case that any of the given key codes is currently being pressed. When the &quot;keyCodes&quot; is an array of arrays with key codes, it will be considered that all keys are being pressed if each single array (all of them) has at least one of its key codes pressed.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3240">line 3240</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>If &quot;allPressed&quot; parameter is set to true, returns true in the case that all given key codes are currently being pressed. If &quot;allPressed&quot; parameter is set to false, returns true in the case that any of the given key codes is currently being pressed. In all other cases, it returns false.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".normalizeEvent"><span class="type-signature">&lt;static> </span>normalizeEvent<span class="signature">(e)</span><span class="type-signature"> &rarr; {Event}</span></h4> </dt> <dd> <div class="description"> <p>Tries to return the given <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent">keyboard event</a> with some properties normalized (since different clients can use different values) and perhaps some new properties added (in the case they were missing), when possible. The new attached methods and properties may include polyfills, etc. It also calls the <a href="CB_Events.html#.normalize"><code>CB_Events.normalize</code></a> function internally. Some properties added or affected could be <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode">keyCode</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location">location</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/ctrlKey">ctrlKey</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/altKey">altKey</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/shiftKey">shiftKey</a>, etc.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>e</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type">Event</span> </td> <td class="description last" style="min-width:310px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent">Keyboard event</a> object. If not provided, it will use the value of &quot;event&quot;, &quot;window.event&quot;, &quot;Event&quot; or an empty object (&quot;{}&quot;).</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="CrossBase_input_CB_Keyboard.js.html">CrossBase/input/CB_Keyboard.js</a>, <a href="CrossBase_input_CB_Keyboard.js.html#sunlight-1-line-3109">line 3109</a> </li> </ul> </dd> <dt class="tag-todo method-doc-label method-doc-details-label">To Do:</dt> <dd class="tag-todo"> <ul> <li>Calculate (if possible) the values for location, ctrlKey, altKey, etc. when added, to simulate the expected behaviour.</li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent">keyboard event</a> object normalized.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Event</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id=".onKeyDown"><span class="type-signature">&lt;static> </span>onKeyDown<span class="signature">(callbackFunction [, keepOldFunction] [, useCapture] [, target])</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Sets a function to execute when a key is down (<a href="https://developer.mozilla.org/en-US/docs/Web/Events/keydown">onKeyDown</a> event) or removes it.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th style="width:12%; min-width:110px;">Name</th> <th style="width:12%; min-width:110px;">Type</th> <th style="width:12%; min-width:110px;">Argument</th> <th style="width:12%; min-width:110px;">Default</th> <th class="last" style="min-width:310px;">Description</th> </tr> </thead> <tbody> <tr> <td class="name" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"><code>callbackFunction</code></td> <td class="type" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> <span class="param-type"><a href="CB_Keyboard.html#.EVENT_CALLBACK">CB_Keyboard.EVENT_CALLBACK</a></span> | <span class="param-type">null</span> </td> <td class="attributes" style="width:12%; min-width:110px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;"> </td> <td class="default" style="width:12%; min-width:110px; overflow-wrap:break-word; word-