first commit
This commit is contained in:
44
pytorrent/static/js/app.js
Normal file
44
pytorrent/static/js/app.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import { stateSource } from './state.js';
|
||||
import { torrentsSource } from './torrents.js';
|
||||
import { apiSource } from './api.js';
|
||||
import { createTorrentSource } from './createTorrent.js';
|
||||
import { torrentDetailsSource } from './torrentDetails.js';
|
||||
import { modalsSource } from './modals.js';
|
||||
import { rssSource } from './rss.js';
|
||||
import { smartQueueSource } from './smartQueue.js';
|
||||
import { plannerSource } from './planner.js';
|
||||
import { pollerSource } from './poller.js';
|
||||
import { dashboardSource } from './dashboard.js';
|
||||
import { chartsSource } from './charts.js';
|
||||
import { bootstrapSource } from './bootstrap.js';
|
||||
|
||||
export const moduleSources = [
|
||||
stateSource,
|
||||
torrentsSource,
|
||||
apiSource,
|
||||
createTorrentSource,
|
||||
torrentDetailsSource,
|
||||
modalsSource,
|
||||
rssSource,
|
||||
smartQueueSource,
|
||||
plannerSource,
|
||||
dashboardSource,
|
||||
pollerSource,
|
||||
chartsSource,
|
||||
bootstrapSource,
|
||||
];
|
||||
|
||||
export function buildRuntimeSource(){
|
||||
return `(() => {\n${moduleSources.join('\n')}\n})();\n`;
|
||||
}
|
||||
|
||||
export function startApp(){
|
||||
const runtimeSource = buildRuntimeSource();
|
||||
// Keep the original shared lexical scope while loading the source from smaller ES modules.
|
||||
// `io` is passed explicitly so Socket.IO remains available inside the generated runtime.
|
||||
return Function('io', runtimeSource)(window.io);
|
||||
}
|
||||
|
||||
if(typeof window !== 'undefined' && !window.PYTORRENT_DISABLE_AUTOSTART){
|
||||
startApp();
|
||||
}
|
||||
Reference in New Issue
Block a user