Skip to content

Commit 3833f19

Browse files
committed
refactor(web): remove some aliases
This is a follow-up of review comments in #15401. - rename `DefaultWorker` → `Worker` - rename `BUTTON_CLASSES` → `buttonClassNames` Both exports now also match the filename. Follow-up-of: #15401 Test-bot: skip
1 parent 2dd1ec7 commit 3833f19

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

web/src/engine/predictive-text/worker-main/src/web/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { LMLayer } from '../lmlayer.js';
2-
export { DefaultWorker as Worker } from './worker.js'; // TODO: eliminate rename
2+
export { Worker } from './worker.js';
33
export { SourcemappedWorker } from './sourcemappedWorker.js';
44

55
export interface WorkerFactory {

web/src/engine/predictive-text/worker-main/src/web/worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { unwrap } from '../unwrap.js';
22
import { LMLayerWorkerCode, LMLayerWorkerSourcemapComment } from "@keymanapp/lm-worker/worker-main.wrapped.min.js";
33

4-
export class DefaultWorker {
4+
export class Worker {
55
static constructInstance(): Worker {
6-
return new Worker(this.asBlobURI(LMLayerWorkerCode));
6+
return new globalThis.Worker(this.asBlobURI(LMLayerWorkerCode));
77
}
88

99
/**

web/src/engine/src/osk/buttonClassNames.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Maps 'sp' properties on a touch-layout spec to their corresponding CSS class names.
44
*/
5-
export const BUTTON_CLASSES = [
5+
export const buttonClassNames = [
66
'default',
77
'shift',
88
'shift-on',

web/src/engine/src/osk/keyboard-layout/oskKey.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { ActiveKey, ActiveSubKey, ButtonClass, ButtonClasses, DeviceSpec } from 'keyman/engine/keyboard';
22

33
// At present, we don't use @keymanapp/keyman. Just `keyman`. (Refer to <root>/web/package.json.)
4-
import { specialCharacters as specialChars } from '../specialCharacters.js'; // TODO: eliminate 'as specialChars'
5-
import { BUTTON_CLASSES as buttonClassNames } from '../buttonClassNames.js'; // TODO: eliminate 'as buttonClasNames'
6-
4+
import { specialCharacters } from '../specialCharacters.js';
5+
import { buttonClassNames } from '../buttonClassNames.js';
76
import { KeyElement } from '../keyElement.js';
87
import { VisualKeyboard } from '../visualKeyboard.js';
98
import { getTextMetrics } from './getTextMetrics.js';
@@ -42,7 +41,7 @@ export function renameSpecialKey(oldText: string, vkbd: VisualKeyboard): string
4241
// do nothing.
4342
}
4443

45-
const specialCode = specialChars[oldText as keyof typeof specialChars];
44+
const specialCode = specialCharacters[oldText as keyof typeof specialCharacters];
4645
const specialCodePUA = 0XE000 + specialCode;
4746

4847
return specialCode ?
@@ -52,7 +51,7 @@ export function renameSpecialKey(oldText: string, vkbd: VisualKeyboard): string
5251

5352
export abstract class OSKKey {
5453
// Only set here to act as an alias for code built against legacy versions.
55-
static readonly specialCharacters = specialChars;
54+
static readonly specialCharacters = specialCharacters;
5655

5756
static readonly BUTTON_CLASSES = buttonClassNames;
5857

0 commit comments

Comments
 (0)