mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 16:35:33 +00:00
Added a kmwembedded flag to make the error output's condition more explicit, refactored in-PR code to match.
This commit is contained in:
parent
e3276228c1
commit
574ac97815
3 changed files with 18 additions and 8 deletions
|
|
@ -3087,20 +3087,24 @@
|
|||
var kbdLang = kbdStub['KL'];
|
||||
var kbdName = kbdStub['KN'];
|
||||
|
||||
if(typeof(kbdStub.asyncLoader.callback) == "function") {
|
||||
// Add a handler for cases where the new <script> block fails to load.
|
||||
Lscript.addEventListener('error', function() {
|
||||
|
||||
// Add a handler for cases where the new <script> block fails to load.
|
||||
Lscript.addEventListener('error', function() {
|
||||
if(kbdStub.asyncLoader.timer !== null) {
|
||||
// Clear the timeout timer.
|
||||
window.clearTimeout(kbdStub.asyncLoader.timer);
|
||||
kbdStub.asyncLoader.timer = null;
|
||||
}
|
||||
|
||||
// Do not output error messages when embedded. (KMEA/KMEI)
|
||||
if(!keymanweb.embedded) {
|
||||
// We already know the load has failed... why wait?
|
||||
kbdStub.asyncLoader.callback('Cannot find the ' + kbdName + ' keyboard for ' + kbdLang + '.');
|
||||
console.log('Error: cannot find the', kbdName, 'keyboard for', kbdLang, 'at', kbdFile + '.');
|
||||
}
|
||||
kbdStub.asyncLoader = null;
|
||||
}, true);
|
||||
|
||||
kbdStub.asyncLoader = null;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// The load event will activate a newly-loaded keyboard if successful and report an error if it is not.
|
||||
Lscript.addEventListener('load', function() {
|
||||
|
|
@ -3137,7 +3141,7 @@
|
|||
util.wait(false);
|
||||
}
|
||||
} // A handler portion for cases where the new <script> block loads, but fails to process.
|
||||
} else if(typeof(kbdStub.asyncLoader.callback) == "function") {
|
||||
} else if(!keymanweb.embedded) { // Do not output error messages when embedded. (KMEA/KMEI)
|
||||
kbdStub.asyncLoader.callback('Error registering the ' + kbdName + ' keyboard for ' + kbdLang + '.');
|
||||
console.log('Error registering the', kbdName, 'keyboard for', kbdLang + '.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@
|
|||
keymanweb.mustReloadKeyboard = true;
|
||||
|
||||
// Skip full page initialization (code not needed for embedded applications)
|
||||
keymanweb.fullInitialization = false;
|
||||
keymanweb.fullInitialization = false;
|
||||
|
||||
// Explicitly marks that KeymanWeb is in embedded mode.
|
||||
keymanweb.embedded = true;
|
||||
|
||||
osk.popupDelay = 400; // Delay must be less than native touch-hold delay
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
// Force full initialization
|
||||
keymanweb.fullInitialization = true;
|
||||
|
||||
// Explicitly marks that KeymanWeb is in native mode.
|
||||
keymanweb.embedded = false;
|
||||
|
||||
/**
|
||||
* Set default device options
|
||||
* @param {Object} opt device options object
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue