Skip to content

Commit

Permalink
Eject disk
Browse files Browse the repository at this point in the history
  • Loading branch information
tyfkda committed Jul 8, 2023
1 parent 59caa7d commit 30a8363
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/app/fds_ctrl_wnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,29 @@ export class FdsCtrlWnd extends Wnd {
}

private createOptions(select: HTMLSelectElement, sideCount: number): void {
{
const option = document.createElement('option')
option.innerText = 'Eject'
select.appendChild(option)
}

const side = ['A', 'B']
for (let i = 0; i < sideCount; ++i) {
const option = document.createElement('option')
option.innerText = `${((i / 2) | 0) + 1}-${side[i & 1]}`
select.appendChild(option)
}
if (sideCount > 0)
select.value = '1-A'

select.addEventListener('change', _ => {
select.addEventListener('change', () => {
const index = select.selectedIndex
this.fds.eject()
setTimeout(() => {
this.fds.setSide(select.selectedIndex)
}, 100)
if (index > 0) {
setTimeout(() => {
this.fds.setSide(index - 1)
}, 1200)
}
})
}
}

0 comments on commit 30a8363

Please sign in to comment.