-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(web): properly support workerless use of Web engine #13290
base: beta
Are you sure you want to change the base?
Conversation
Fixes: #13262 Fixes: KEYMANWEB-COM-1VH
User Test ResultsTest specification and instructions Test Artifacts
|
Test ResultsI tested this issue with the attached Keyman"18.0.197-beta-test-13290" build(20/02/2025) on Android 14(Physical device). Here I am sharing my observation.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
try { | ||
this.lmEngine = new LMLayer(capabilities, predictiveWorkerFactory?.constructInstance()); | ||
} catch { | ||
// We can condition on `lmEngine` being null/undefined. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the try/catch would be around constructInstance() only, not around new LMLayer. Even then, if there is an error in the constructor apart from the WebWorker not being available, the catchall is going to mask the error completely. Hence, I think we should console.warn()
on it (not sure my suggestion is perfect here).
try { | |
this.lmEngine = new LMLayer(capabilities, predictiveWorkerFactory?.constructInstance()); | |
} catch { | |
// We can condition on `lmEngine` being null/undefined. | |
} | |
let instance: <TypeHere>; | |
try { | |
instance = predictiveWorkerFactory?.constructInstance(); | |
} catch(e) { | |
// We can condition on `lmEngine` being null/undefined. | |
console.warn('Web workers are not available: ' + (e ?? '').toString()); | |
instance = null; | |
} | |
if(instance) { | |
this.lmEngine = new LMLayer(capabilities, instance); | |
} |
Fixes: #13262
Fixes: KEYMANWEB-COM-1VH
Supersedes: #13270.
User Testing
TEST_ANDROID_PREDICTIONS: Using the Keyman for Android test artifact, verify that predictive text appears to function as usual.