Docs update

This commit is contained in:
Francisco Hodge 2018-10-31 17:56:32 -04:00
parent 472df83482
commit 295493e976
9 changed files with 69423 additions and 48613 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -249,6 +249,62 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-holdInteractionTimeout">holdInteractionTimeout</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>
</p>
</div>
<div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-holdTimeout">holdTimeout</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>
</p>
</div>
<div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
@ -307,6 +363,34 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-isMouseHold">isMouseHold</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
</p>
</div>
<div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
@ -378,7 +462,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<div>
<div data-ice="description"><p>Module namespace</p>
<div data-ice="description"><p>Modules</p>
</div>
</div>
</td>
@ -776,6 +860,93 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleButtonHold">handleButtonHold</a></span></span><span class="code" data-ice="signature">(button: <span>*</span>)</span>
</p>
</div>
<div>
<div data-ice="description"><p>Handles button hold</p>
</div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleButtonMouseDown">handleButtonMouseDown</a></span></span><span class="code" data-ice="signature">(button: <span>*</span>, e: <span>*</span>)</span>
</p>
</div>
<div>
<div data-ice="description"><p>Handles button mousedown</p>
</div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleButtonMouseUp">handleButtonMouseUp</a></span></span><span class="code" data-ice="signature">()</span>
</p>
</div>
<div>
<div data-ice="description"><p>Handles button mouseup</p>
</div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
@ -805,6 +976,35 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span class="code" data-ice="name"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-loadModules">loadModules</a></span></span><span class="code" data-ice="signature">()</span>
</p>
</div>
<div>
<div data-ice="description"><p>Load modules</p>
</div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
@ -1088,7 +1288,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber116">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber115">source</a></span></span>
</span>
</h3>
@ -1131,7 +1331,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber446">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber512">source</a></span></span>
</span>
</h3>
@ -1176,7 +1376,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber491">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber578">source</a></span></span>
</span>
</h3>
@ -1220,7 +1420,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber501">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber588">source</a></span></span>
</span>
</h3>
@ -1251,6 +1451,92 @@ As keys are pressed, text will be added/removed at that position within the inpu
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-holdInteractionTimeout">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">holdInteractionTimeout</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber253">source</a></span></span>
</span>
</h3>
<div data-ice="properties">
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-holdTimeout">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">holdTimeout</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber217">source</a></span></span>
</span>
</h3>
<div data-ice="properties">
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-initialized">
@ -1264,7 +1550,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber637">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber725">source</a></span></span>
</span>
</h3>
@ -1308,7 +1594,7 @@ As keys are pressed, text will be added/removed at that position within the inpu
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber105">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber104">source</a></span></span>
</span>
</h3>
@ -1375,6 +1661,49 @@ keyboard.clearInput();</code></pre>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-isMouseHold">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">isMouseHold</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber212">source</a></span></span>
</span>
</h3>
<div data-ice="properties">
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-keyboardDOM">
@ -1432,7 +1761,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber111">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber110">source</a></span></span>
</span>
</h3>
@ -1475,14 +1804,14 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber69">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber144">source</a></span></span>
</span>
</h3>
<div data-ice="description"><p>Module namespace</p>
<div data-ice="description"><p>Modules</p>
</div>
@ -1719,7 +2048,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber140">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber139">source</a></span></span>
</span>
</h3>
@ -1763,7 +2092,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber482">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber548">source</a></span></span>
</span>
</h3>
@ -1807,7 +2136,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber266">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber327">source</a></span></span>
</span>
</h3>
@ -1898,7 +2227,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber302">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber368">source</a></span></span>
</span>
</h3>
@ -1978,7 +2307,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber435">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber501">source</a></span></span>
</span>
</h3>
@ -2038,7 +2367,7 @@ keyboard.clearInput();</code></pre>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber276">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber342">source</a></span></span>
</span>
</h3>
@ -2083,7 +2412,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber211">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber272">source</a></span></span>
</span>
</h3>
@ -2144,7 +2473,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber286">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber352">source</a></span></span>
</span>
</h3>
@ -2217,7 +2546,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber404">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber470">source</a></span></span>
</span>
</h3>
@ -2290,7 +2619,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber226">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber287">source</a></span></span>
</span>
</h3>
@ -2363,7 +2692,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber146">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber152">source</a></span></span>
</span>
</h3>
@ -2423,6 +2752,176 @@ Used interally between re-renders.</p>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-handleButtonHold">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">handleButtonHold</span><span class="code" data-ice="signature">(button: <span>*</span>)</span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber249">source</a></span></span>
</span>
</h3>
<div data-ice="description"><p>Handles button hold</p>
</div>
<div data-ice="properties"><div data-ice="properties">
<h4 data-ice="title">Params:</h4>
<table class="params">
<thead>
<tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
</thead>
<tbody>
<tr data-ice="property" data-depth="0">
<td data-ice="name" class="code" data-depth="0">button</td>
<td data-ice="type" class="code"><span>*</span></td>
<td data-ice="appendix"></td>
<td data-ice="description"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-handleButtonMouseDown">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">handleButtonMouseDown</span><span class="code" data-ice="signature">(button: <span>*</span>, e: <span>*</span>)</span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber208">source</a></span></span>
</span>
</h3>
<div data-ice="description"><p>Handles button mousedown</p>
</div>
<div data-ice="properties"><div data-ice="properties">
<h4 data-ice="title">Params:</h4>
<table class="params">
<thead>
<tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
</thead>
<tbody>
<tr data-ice="property" data-depth="0">
<td data-ice="name" class="code" data-depth="0">button</td>
<td data-ice="type" class="code"><span>*</span></td>
<td data-ice="appendix"></td>
<td data-ice="description"></td>
</tr>
<tr data-ice="property" data-depth="0">
<td data-ice="name" class="code" data-depth="0">e</td>
<td data-ice="type" class="code"><span>*</span></td>
<td data-ice="appendix"></td>
<td data-ice="description"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-handleButtonMouseUp">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">handleButtonMouseUp</span><span class="code" data-ice="signature">()</span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber239">source</a></span></span>
</span>
</h3>
<div data-ice="description"><p>Handles button mouseup</p>
</div>
<div data-ice="properties">
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-handleCaret">
@ -2436,7 +2935,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber422">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber488">source</a></span></span>
</span>
</h3>
@ -2467,6 +2966,50 @@ Used interally between re-renders.</p>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-loadModules">
<span class="access" data-ice="access">public</span>
<span class="code" data-ice="name">loadModules</span><span class="code" data-ice="signature">()</span>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber558">source</a></span></span>
</span>
</h3>
<div data-ice="description"><p>Load modules</p>
</div>
<div data-ice="properties">
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-onInit">
@ -2480,7 +3023,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber457">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber523">source</a></span></span>
</span>
</h3>
@ -2524,7 +3067,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber474">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber540">source</a></span></span>
</span>
</h3>
@ -2568,7 +3111,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber352">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber418">source</a></span></span>
</span>
</h3>
@ -2648,7 +3191,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber508">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber595">source</a></span></span>
</span>
</h3>
@ -2692,7 +3235,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber258">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber319">source</a></span></span>
</span>
</h3>
@ -2753,7 +3296,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber243">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber304">source</a></span></span>
</span>
</h3>
@ -2821,7 +3364,7 @@ Used interally between re-renders.</p>
<span class="right-info">
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber201">source</a></span></span>
<span data-ice="source"><span><a href="file/src/lib/components/Keyboard.js.html#lineNumber262">source</a></span></span>
</span>
</h3>

View File

@ -1,7 +1,7 @@
{
"coverage": "100%",
"expectCount": 68,
"actualCount": 68,
"expectCount": 75,
"actualCount": 75,
"files": {
"src/demo/App.js": {
"expectCount": 8,
@ -9,8 +9,8 @@
"undocumentLines": []
},
"src/lib/components/Keyboard.js": {
"expectCount": 32,
"actualCount": 32,
"expectCount": 39,
"actualCount": 39,
"undocumentLines": []
},
"src/lib/services/KeyboardLayout.js": {

View File

@ -68,7 +68,7 @@ class App {
* Creates a new simple-keyboard instance
*/
this.keyboard = new Keyboard({
debug: true,
//debug: true,
layoutName: this.layoutName,
onChange: input =&gt; this.onChange(input),
onKeyPress: button =&gt; this.onKeyPress(button),

View File

@ -105,11 +105,6 @@ class SimpleKeyboard {
this.options.theme = this.options.theme || &quot;hg-theme-default&quot;;
this.options.inputName = this.options.inputName || &quot;default&quot;;
/**
* Module namespace
*/
this.modules = {};
/**
* Bindings
*/
@ -129,6 +124,10 @@ class SimpleKeyboard {
this.onInit = this.onInit.bind(this);
this.onRender = this.onRender.bind(this);
this.render = this.render.bind(this);
this.loadModules = this.loadModules.bind(this);
this.handleButtonMouseUp = this.handleButtonMouseUp.bind(this);
this.handleButtonMouseDown = this.handleButtonMouseDown.bind(this);
this.handleButtonHold = this.handleButtonHold.bind(this);
/**
* simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).
@ -180,7 +179,14 @@ class SimpleKeyboard {
* Physical Keyboard support
*/
this.physicalKeyboardInterface = new PhysicalKeyboard(this);
/**
* Modules
*/
this.modules = {};
this.loadModules();
}
/**
* Handles clicks made to keyboard buttons
* @param {string} button The button&apos;s layout name.
@ -237,6 +243,61 @@ class SimpleKeyboard {
}
}
/**
* Handles button mousedown
*/
/* istanbul ignore next */
handleButtonMouseDown(button, e){
/**
* @type {boolean} Whether the mouse is being held onKeyPress
*/
this.isMouseHold = true;
/**
* @type {object} Time to wait until a key hold is detected
*/
this.holdTimeout = setTimeout(() =&gt; {
if(
this.isMouseHold &amp;&amp;
(
(!button.includes(&quot;{&quot;) &amp;&amp; !button.includes(&quot;}&quot;)) ||
button === &quot;{bksp}&quot; ||
button === &quot;{space}&quot; ||
button === &quot;{tab}&quot;
)
){
if(this.options.debug)
console.log(&quot;Button held:&quot;, button);
this.handleButtonHold(button, e);
}
clearTimeout(this.holdTimeout);
}, 500);
}
/**
* Handles button mouseup
*/
handleButtonMouseUp(){
this.isMouseHold = false;
if(this.holdInteractionTimeout)
clearTimeout(this.holdInteractionTimeout);
}
/**
* Handles button hold
*/
/* istanbul ignore next */
handleButtonHold(button){
/**
* @type {object} Timeout dictating the speed of key hold iterations
*/
this.holdInteractionTimeout = setTimeout(() =&gt; {
this.handleButtonClicked(button);
this.handleButtonHold(button);
}, 100);
}
/**
* Send a command to all simple-keyboard instances (if you have several instances).
*/
@ -309,6 +370,11 @@ class SimpleKeyboard {
option = option || {};
this.options = Object.assign(this.options, option);
this.render();
/**
* Apply modules
*/
this.loadModules();
}
/**
@ -522,11 +588,32 @@ class SimpleKeyboard {
* Register module
*/
registerModule = (name, initCallback) =&gt; {
this.modules[name] = {};
if(!this.modules[name])
this.modules[name] = {};
initCallback(this.modules[name]);
}
/**
* Load modules
*/
loadModules(){
if(Array.isArray(this.options.modules)){
this.options.modules.forEach(Module =&gt; {
let module = new Module();
/* istanbul ignore next */
if(module.constructor.name &amp;&amp; module.constructor.name !== &quot;Function&quot;){
this.keyboardDOM.classList.add(
`module-${this.utilities.camelCase(module.constructor.name)}`
);
}
module.init(this);
});
}
}
/**
* Get module prop
*/
@ -621,6 +708,7 @@ class SimpleKeyboard {
var buttonDOM = document.createElement(&apos;div&apos;);
buttonDOM.className += `hg-button ${fctBtnClass}${buttonThemeClass ? &quot; &quot;+buttonThemeClass : &quot;&quot;}`;
buttonDOM.onclick = () =&gt; this.handleButtonClicked(button);
buttonDOM.onmousedown = (e) =&gt; this.handleButtonMouseDown(button, e);
/**
* Adding identifier
@ -678,6 +766,11 @@ class SimpleKeyboard {
*/
this.initialized = true;
/**
* Handling mouseup
*/
document.onmouseup = () =&gt; this.handleButtonMouseUp();
/**
* Calling onInit
*/

File diff suppressed because one or more lines are too long

View File

@ -455,12 +455,42 @@ window.esdocSearchIndex = [
"src/lib/components/Keyboard.js~SimpleKeyboard#handleButtonClicked",
"method"
],
[
"src/lib/components/keyboard.js~simplekeyboard#handlebuttonhold",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleButtonHold",
"src/lib/components/Keyboard.js~SimpleKeyboard#handleButtonHold",
"method"
],
[
"src/lib/components/keyboard.js~simplekeyboard#handlebuttonmousedown",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleButtonMouseDown",
"src/lib/components/Keyboard.js~SimpleKeyboard#handleButtonMouseDown",
"method"
],
[
"src/lib/components/keyboard.js~simplekeyboard#handlebuttonmouseup",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleButtonMouseUp",
"src/lib/components/Keyboard.js~SimpleKeyboard#handleButtonMouseUp",
"method"
],
[
"src/lib/components/keyboard.js~simplekeyboard#handlecaret",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-handleCaret",
"src/lib/components/Keyboard.js~SimpleKeyboard#handleCaret",
"method"
],
[
"src/lib/components/keyboard.js~simplekeyboard#holdinteractiontimeout",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-holdInteractionTimeout",
"src/lib/components/Keyboard.js~SimpleKeyboard#holdInteractionTimeout",
"member"
],
[
"src/lib/components/keyboard.js~simplekeyboard#holdtimeout",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-holdTimeout",
"src/lib/components/Keyboard.js~SimpleKeyboard#holdTimeout",
"member"
],
[
"src/lib/components/keyboard.js~simplekeyboard#initialized",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-initialized",
@ -473,6 +503,12 @@ window.esdocSearchIndex = [
"src/lib/components/Keyboard.js~SimpleKeyboard#input",
"member"
],
[
"src/lib/components/keyboard.js~simplekeyboard#ismousehold",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-isMouseHold",
"src/lib/components/Keyboard.js~SimpleKeyboard#isMouseHold",
"member"
],
[
"src/lib/components/keyboard.js~simplekeyboard#keyboarddom",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-keyboardDOM",
@ -485,6 +521,12 @@ window.esdocSearchIndex = [
"src/lib/components/Keyboard.js~SimpleKeyboard#keyboardDOMClass",
"member"
],
[
"src/lib/components/keyboard.js~simplekeyboard#loadmodules",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-method-loadModules",
"src/lib/components/Keyboard.js~SimpleKeyboard#loadModules",
"method"
],
[
"src/lib/components/keyboard.js~simplekeyboard#modules",
"class/src/lib/components/Keyboard.js~SimpleKeyboard.html#instance-member-modules",

View File

@ -39,7 +39,7 @@
</div>
</nav>
<div class="content" data-ice="content"><h1>Source <img data-ice="coverageBadge" src="./badge.svg"><span data-ice="totalCoverageCount" class="total-coverage-count">68/68</span></h1>
<div class="content" data-ice="content"><h1>Source <img data-ice="coverageBadge" src="./badge.svg"><span data-ice="totalCoverageCount" class="total-coverage-count">75/75</span></h1>
<table class="files-summary" data-ice="files" data-use-coverage="true">
<thead>
@ -58,9 +58,9 @@
<td data-ice="filePath"><span><a href="file/src/demo/App.js.html">src/demo/App.js</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="class/src/demo/App.js~App.html">App</a></span></td>
<td class="coverage"><span data-ice="coverage">100 %</span><span data-ice="coverageCount" class="coverage-count">8/8</span></td>
<td style="display: none;" data-ice="size">1919 byte</td>
<td style="display: none;" data-ice="size">1921 byte</td>
<td style="display: none;" data-ice="lines">84</td>
<td style="display: none;" data-ice="updated">2018-10-04 23:21:26 (UTC)</td>
<td style="display: none;" data-ice="updated">2018-10-04 19:55:38 (UTC)</td>
</tr>
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/src/demo/index.js.html">src/demo/index.js</a></span></td>
@ -73,10 +73,10 @@
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/src/lib/components/Keyboard.js.html">src/lib/components/Keyboard.js</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="class/src/lib/components/Keyboard.js~SimpleKeyboard.html">SimpleKeyboard</a></span></td>
<td class="coverage"><span data-ice="coverage">100 %</span><span data-ice="coverageCount" class="coverage-count">32/32</span></td>
<td style="display: none;" data-ice="size">21368 byte</td>
<td style="display: none;" data-ice="lines">647</td>
<td style="display: none;" data-ice="updated">2018-10-04 03:15:23 (UTC)</td>
<td class="coverage"><span data-ice="coverage">100 %</span><span data-ice="coverageCount" class="coverage-count">39/39</span></td>
<td style="display: none;" data-ice="size">23754 byte</td>
<td style="display: none;" data-ice="lines">740</td>
<td style="display: none;" data-ice="updated">2018-10-04 21:54:18 (UTC)</td>
</tr>
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/src/lib/index.js.html">src/lib/index.js</a></span></td>