-
Notifications
You must be signed in to change notification settings - Fork 235
Expand file tree
/
Copy pathspeech.js
More file actions
27 lines (24 loc) · 891 Bytes
/
speech.js
File metadata and controls
27 lines (24 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import './lib/speech.js';
import {combineDefaults} from '#js/components/global.js';
import {Package} from '#js/components/package.js';
import {hasWindow} from '#js/util/context.js';
import {SpeechHandler} from '#js/a11y/speech.js';
if (MathJax.loader) {
let path = Package.resolvePath('[sre]', false);
if (!hasWindow) {
const REQUIRE = typeof require !== 'undefined' ? require : MathJax.config.loader.require;
if (REQUIRE?.resolve) {
const pool = MathJax.config.options?.worker?.pool || 'speech-workerpool.js';
path = path.replace(/\/bundle\/sre$/, '/cjs/a11y/sre');
path = REQUIRE.resolve(`${path}/${pool}`).replace(/\/[^\/]*$/, '');
} else {
path = '';
}
}
if (path) {
combineDefaults(MathJax.config, 'options', { worker: { path } });
}
}
if (MathJax.startup) {
MathJax.startup.extendHandler(handler => SpeechHandler(handler));
}