Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions testsuite/expected/base/api_test.json

Large diffs are not rendered by default.

125 changes: 0 additions & 125 deletions ts/common/browser_util.ts

This file was deleted.

13 changes: 0 additions & 13 deletions ts/common/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,6 @@ export class Engine {
return this._defaultLocale;
}

/**
* Current browser is MS Internet Explorer but not Edge.
*/
public isIE = false;

/**
* Current browser is MS Edge.
*/
public isEdge = false;

/**
* @returns The Engine object.
*/
Expand Down Expand Up @@ -274,9 +264,6 @@ export class Engine {
if (feature.json) {
SystemExternal.jsonPath = FileUtil.makePath(feature.json as string);
}
if (feature.xpath) {
SystemExternal.WGXpath = feature.xpath as string;
}
this.setCustomLoader(feature.custom);
}

Expand Down
14 changes: 0 additions & 14 deletions ts/common/engine_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import * as L10n from '../l10n/l10n.js';
import * as MathMap from '../speech_rules/math_map.js';
import * as BrowserUtil from './browser_util.js';
import { Debugger } from './debugger.js';
import { Engine, EnginePromise } from './engine.js';
import { SystemExternal } from './system_external.js';
Expand All @@ -41,7 +40,6 @@ export async function setupEngine(feature: { [key: string]: boolean | string })
}
const engine = Engine.getInstance();
engine.setup(feature);
setupBrowsers(engine);
L10n.setLocale();
engine.setDynamicCstr();
// We add a break in the execution flow so custom loaders can set up.
Expand All @@ -61,17 +59,6 @@ export async function setupEngine(feature: { [key: string]: boolean | string })
return MathMap.loadLocale();
}

/**
* Sets up browser specific functionality.
*
* @param engine The Engine object.
* @deprecated
*/
function setupBrowsers(engine: Engine) {
engine.isIE = BrowserUtil.detectIE();
engine.isEdge = BrowserUtil.detectEdge();
}

/**
* Query the engine setup.
*
Expand All @@ -81,7 +68,6 @@ function setupBrowsers(engine: Engine) {
export function engineSetup(): { [key: string]: boolean | string } {
const features: { [key: string]: string | boolean } = Engine.getInstance().json();
features.json = SystemExternal.jsonPath;
features.xpath = SystemExternal.WGXpath;
return features;
}

58 changes: 0 additions & 58 deletions ts/common/mathjax.ts

This file was deleted.

10 changes: 0 additions & 10 deletions ts/common/system_external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,5 @@ export const SystemExternal: any = {
: process.cwd() + '/lib/mathmaps';
})(),

/**
* Path to Xpath library file.
*/
WGXpath: Variables.WGXpath,

/**
* WGXpath library.
*/
wgxpath: null as any,

xpath: xpath
};
6 changes: 0 additions & 6 deletions ts/common/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,4 @@ export class Variables {
'https://cdn.jsdelivr.net/npm/speech-rule-engine@' +
Variables.VERSION +
'/lib/mathmaps';

/**
* Path to Xpath library file.
*/
public static readonly WGXpath: string =
'https://cdn.jsdelivr.net/npm/wicked-good-xpath@1.3.0/dist/wgxpath.install.js';
}
39 changes: 3 additions & 36 deletions ts/speech_rules/math_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* @author sorge@google.com (Volker Sorge)
*/

import * as BrowserUtil from '../common/browser_util.js';
import { Engine, EnginePromise } from '../common/engine.js';
import * as EngineConst from '../common/engine_const.js';
import * as FileUtil from '../common/file_util.js';
Expand Down Expand Up @@ -135,11 +134,12 @@ export function standardLoader() {
}

/**
* Retrieves JSON rule mappings for a given locale.
* Retrieves JSON rule mappings for a given locale and adds them to the
* respective stores.
*
* @param locale The target locale.
*/
function retrieveFiles(locale: string) {
function retrieveMaps(locale: string) {
const loader = loadMethod();
const promise = new Promise<string>((res) => {
const inner = loader(locale);
Expand Down Expand Up @@ -195,39 +195,6 @@ function addMaps(json: MathMapJson, opt_locale?: string) {
}
}

/**
* Retrieves mappings and adds them to the respective stores.
*
* @param locale The target locale.
*/
function retrieveMaps(locale: string) {
if (
Engine.getInstance().isIE &&
Engine.getInstance().mode === EngineConst.Mode.HTTP
) {
getJsonIE_(locale);
return;
}
retrieveFiles(locale);
}

/**
* Gets JSON elements from the global JSON object in case of IE browsers.
*
* @param locale The target locale.
* @param opt_count Optional counter argument for callback.
*/
function getJsonIE_(locale: string, opt_count?: number) {
let count = opt_count || 1;
if (!BrowserUtil.mapsForIE) {
if (count <= 5) {
setTimeout((() => getJsonIE_(locale, count++)).bind(this), 300);
}
return;
}
addMaps(BrowserUtil.mapsForIE as MathMapJson, locale);
}

/**
* Computes path to a JSON file from the locale and returns a JSON object.
*
Expand Down
Loading