Skip to content

[Web] Core refactoring#356

Merged
jahorton merged 16 commits into
masterfrom
web-349-core-refactoring
Nov 13, 2017
Merged

[Web] Core refactoring#356
jahorton merged 16 commits into
masterfrom
web-349-core-refactoring

Conversation

@jahorton
Copy link
Copy Markdown
Contributor

@jahorton jahorton commented Oct 12, 2017

Addresses the KMW part of #349.

https://github.com/sillsdev/keyman-help.keyman.com/pull/114 addresses the help.keyman.com side of things, reflecting the new name changes made here.

@jahorton jahorton added this to the P2S6 milestone Oct 12, 2017
@jahorton jahorton mentioned this pull request Oct 12, 2017
13 tasks
@darcywong00 darcywong00 self-requested a review October 12, 2017 09:02
Copy link
Copy Markdown
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One kmw got missed in samplehdr.js addKeyboard(n)

Comment thread web/samples/samplehdr.js
function loadKeyboards()
{
var kmw=tavultesoft.keymanweb;
var kmw=keyman;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 85 will also need to be changed for kmw

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, got it now.

Copy link
Copy Markdown
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's 2 more lines to update in the test chirality.js keyboard

continue;
} else if(kls[layer][key] != '') {
if (k.KKM(e, modCode, k.osk.keyCodes[keySymbol])) {
if (k.KKM(e, modCode, osk.keyCodes[keySymbol])) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this become kbdInterface.keyMatch?

Copy link
Copy Markdown
Contributor Author

@jahorton jahorton Oct 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From kmwcallback.js:

var keymanweb=window['keyman'], kbdInterface=window['KeymanWeb']=keymanweb['interface'], KeymanWeb=kbdInterface;

//...

KeymanWeb['KKM'] = kbdInterface['keyMatch'] = kbdInterface.keyMatch = function(e,Lruleshift,Lrulekey) // ...

Technically speaking, both KKM and keyMatch are both fields of k. Old keyboards will only know this as k.KKM, which must be supported through a legacy KeymanWeb variable, which is how k is set above.

The published API will instead point people to keyman.interface.keyMatch, which is a more user-friendly/documentation-friendly name for the same function. KeymanWeb === keyman.interface.

If the initialization at the top is fun to parse, it goes like this.

var keymanweb=window['keyman'], kbdInterface=window['KeymanWeb']=keymanweb['interface'], KeymanWeb=kbdInterface;

Left to right

  • keymanweb refers to the global variable keyman. It used to refer to tavultesoft.keymanweb; reusing it with no variable name refactoring means a lot less review clutter, as we can leave many old lines in place unchanged.
  • Define a new global KeymanWeb (via window) and set it as an alias to keyman.interface. Also set the local shorthand kbdInterface so that it's clear we're defining methods for use through keyman.interface.
  • Create a direct alias for that local shorthand to clearly establish the method names provided for legacy support.
KeymanWeb['KKM'] = kbdInterface['keyMatch'] = kbdInterface.keyMatch = function(e,Lruleshift,Lrulekey) // ...

Left to right

  • Define the legacy name for the keyboard interface function.
  • Establish it as an exposed name for the API. (b/c Google Closures is a thing)
  • Establish it as an internal name for minification. (b/c Google Closures is a thing)
  • Define the function.

So, chirality.js is still using the legacy interface, same as all the other old keyboards.

if (k.KKM(e, modCode, osk.keyCodes[keySymbol])) {
r = m = 1;
if(k.KSM(e, k.osk.modifierCodes['CAPS'])) {
if(k.KSM(e, osk.modifierCodes['CAPS'])) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and kbdInterface.stateMatch

@mcdurdin mcdurdin modified the milestones: P2S6, P2S7 Oct 24, 2017
@jahorton jahorton merged commit ef3eeac into master Nov 13, 2017
@jahorton jahorton deleted the web-349-core-refactoring branch November 13, 2017 06:10
kingsuper195 pushed a commit to kingsuper195/keyman that referenced this pull request Jan 16, 2026
fix: Add Docker for developer use 🦭
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants