LANCommander/LANCommander.Client/wwwroot/scripts/SplitPane.ts
Pat Hartl f2127e4987 Add split pane to library view, working game install
Implemented a basic way to queue games using DownloadService. Games will download and extract without blocking UI, but more needs to be done to reflect the game in UI and database.
2024-05-25 15:40:31 -05:00

29 lines
No EOL
772 B
TypeScript

import Split from 'split.js'
export default class SplitPane {
SplitPanes: HTMLElement[] = [];
Init(paneId: string) {
let splitPane = document.querySelector<HTMLElement>(`#split-pane-${paneId}`);
if (splitPane != null) {
let panes = Array.from(splitPane.querySelectorAll<HTMLElement>('.pane'));
let opts = new SplitPaneOptions();
for (let pane of panes) {
let size = parseInt(pane.getAttribute('data-size'));
if (isNaN(size))
opts.sizes.push(0);
else
opts.sizes.push(size);
}
Split(panes, opts);
}
}
}
class SplitPaneOptions implements Split.Options {
sizes: number[] = [];
}