24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
// Stable migration surface for the legacy shared-global frontend.
|
|
// Existing names remain available for compatibility; new code should prefer
|
|
// these namespaces while the large Audiobook/Rehearser files are split.
|
|
(function exposeTtvcNamespaces() {
|
|
const root = window.TTVC = window.TTVC || {};
|
|
root.audiobook = root.audiobook || {};
|
|
root.rehearser = root.rehearser || {};
|
|
root.jobs = root.jobs || {};
|
|
[
|
|
['audiobook', 'fetchWithTimeout', 'audiobookFetchWithTimeout'],
|
|
['audiobook', 'attributeStream', 'audiobookAttributeStream'],
|
|
['audiobook', 'timeoutSeconds', 'audiobookTimeoutSeconds'],
|
|
['rehearser', 'renderLibrary', 'renderLibraryList'],
|
|
['rehearser', 'showPhase', 'showPhase'],
|
|
].forEach(([namespace, publicName, legacyName]) => {
|
|
if (typeof window[legacyName] !== 'undefined' && root[namespace][publicName] == null) {
|
|
root[namespace][publicName] = window[legacyName];
|
|
}
|
|
});
|
|
// `rehState` is a top-level lexical binding for compatibility and therefore
|
|
// is not guaranteed to be an own property of window.
|
|
if (typeof rehState !== 'undefined' && root.rehearser.state == null) root.rehearser.state = rehState;
|
|
})();
|