Skip to content

Commit

Permalink
Merge pull request #13272 from keymanapp/docs/web/guide-example-promi…
Browse files Browse the repository at this point in the history
…se-use

docs(web): use promise-chaining in manual-control example
  • Loading branch information
jahorton authored Feb 18, 2025
2 parents 04f279f + 8421409 commit 7902260
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
13 changes: 4 additions & 9 deletions web/docs/engine/guide/examples/__manual-control.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,16 @@
<script type='text/javascript' src='js/laokeys_load.js'></script>

<script type="text/javascript">

var KWControl = null;

function SetupDocument()
{
keyman.init();
KWControl = document.getElementById('KWControl');
keyman.setActiveKeyboard('laokeys');
keyman.osk.hide();
keyman.init().then(function() {
keyman.setActiveKeyboard('laokeys');
keyman.osk.hide();
});
}

function KWControlClick()
{
var KWControl = document.getElementById('KWControl');

if(keyman.osk.isEnabled()) {
keyman.osk.hide();
} else {
Expand Down
15 changes: 7 additions & 8 deletions web/docs/engine/guide/examples/manual-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ Include the following script in the HEAD of your page:
function SetupDocument()
{
/* Make sure that Keyman is initialized (we can't guarantee initialization order) */
keyman.init();

KWControl = document.getElementById('KWControl');
/* Prevents automatic display of the onscreen keyboard. (default automatic) */
keyman.osk.hide();
/* Select the LaoKeys keyboard */
keyman.setActiveKeyboard('laokeys');
keyman.init().then(function () {
/* Prevents automatic display of the onscreen keyboard. (default automatic) */
keyman.osk.hide();
/* Select the LaoKeys keyboard */
keyman.setActiveKeyboard('laokeys');
});
}

/* KWControlClick: Called when user clicks on the KWControl IMG */
Expand Down Expand Up @@ -56,7 +55,7 @@ And finally, include the control img for KeymanWeb:

```html
<!-- Display the KeymanWeb icon for the user to click on -->
<img style="border: solid 1px black; padding: 2px 2px 3px 2px" src='kmicon.png' alt='KeymanWeb' onclick='KWControlClick()' id='KWControl' />
<img style="border: solid 1px black; padding: 2px 2px 3px 2px" src='kmicon.png' alt='KeymanWeb' onclick='KWControlClick()' />
```

## API References
Expand Down

0 comments on commit 7902260

Please sign in to comment.