mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-13 12:19:25 +00:00
chore(common/lmlayer): Merge branch 'refactor/common/lmlayer/headless-variant' into feat/common/lmlayer/headless-testing
This commit is contained in:
commit
8f261f9c5d
1 changed files with 12 additions and 1 deletions
|
|
@ -72,7 +72,18 @@ namespace com.keyman.text.prediction {
|
|||
postMessage(message: any, transfer: any[]): void;
|
||||
postMessage(message: any, options?: PostMessageOptions): void;
|
||||
postMessage(message: any, options?: any) {
|
||||
this._worker.onMessage({data: message} as any as MessageEvent);
|
||||
let msgObj = {data: message};
|
||||
let msgJSON = JSON.stringify(msgObj);
|
||||
|
||||
/*
|
||||
* Execute the command within the virtualized worker's scope. The worker's returned
|
||||
* `postMessage` calls will still reach outside, as they have a reference to `this` via
|
||||
* `postMessage` (which we've set to a bound `this.workerPostMessage`).
|
||||
*
|
||||
* Among other things, this will allow the worker to use its internal namespaces without issue.
|
||||
*/
|
||||
let msgCommand = "onmessage(" + msgJSON + ")";
|
||||
this._workerContext.__importScriptString(msgCommand);
|
||||
}
|
||||
|
||||
terminate(): void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue