spiegel-keyman/web/source/kmwapi.ts
Joshua A. Horton 72bdc8d2de Fixes #1638.
2019-03-07 09:31:34 +07:00

58 lines
No EOL
2 KiB
TypeScript

/// <reference path="kmwbase.ts" />
/// <reference path="kmwutils.ts" />
/// <reference path="text/kbdInterface.ts" />
/**
* This file generates aliases linking renamed functions to some of our published developer API for KMW.
* This won't enable Closure to do "advanced minification", but it's useful for ensuring we don't break
* things people depended on in legacy versions.
*/
// Util.ts
(function() {
let prototype = com.keyman.Util.prototype;
var publishAPI = function(legacyName: string, name: string) {
prototype[legacyName] = prototype[name];
}
// These four were renamed, but we need to maintain their legacy names.
publishAPI("_GetAbsoluteX", 'getAbsoluteX');
publishAPI("_GetAbsoluteY", "getAbsoluteY");
publishAPI("_GetAbsolute", "getAbsolute");
publishAPI("toNzString", "nzString");
}());
// Keyboard callbacks
(function() {
let prototype = com.keyman.text.KeyboardInterface.prototype;
var exportKBCallback = function(miniName: string, longName: string) {
prototype[miniName] = prototype[longName];
}
exportKBCallback('KSF', 'saveFocus');
exportKBCallback('KBR', 'beepReset');
exportKBCallback('KT', 'insertText');
exportKBCallback('KR', 'registerKeyboard');
exportKBCallback('KRS', 'registerStub');
exportKBCallback('KC', 'context');
exportKBCallback('KN', 'nul');
exportKBCallback('KCM', 'contextMatch');
exportKBCallback('KFCM', 'fullContextMatch');
exportKBCallback('KIK', 'isKeypress');
exportKBCallback('KKM', 'keyMatch');
exportKBCallback('KSM', 'stateMatch');
exportKBCallback('KKI', 'keyInformation');
exportKBCallback('KDM', 'deadkeyMatch');
exportKBCallback('KB', 'beep');
exportKBCallback('KA', 'any');
exportKBCallback('KDC', 'deleteContext');
exportKBCallback('KO', 'output');
exportKBCallback('KDO', 'deadkeyOutput');
exportKBCallback('KIO', 'indexOutput');
exportKBCallback('KIFS', 'ifStore');
exportKBCallback('KSETS', 'setStore');
exportKBCallback('KLOAD', 'loadStore');
exportKBCallback('KSAVE', 'saveStore');
}());