apple2js/js/ui/drive_lights.ts
Ian Flanigan 6395a9009e
Converts ui/drive_lights.js to Typescript (#70)
This change also exposes the `Callbacks` and `DriveNumber` types from
`disk2.ts`.
2021-03-26 07:45:51 -07:00

25 lines
774 B
TypeScript

import { Callbacks, DriveNumber } from '../cards/disk2';
export default class DriveLights implements Callbacks {
public driveLight(drive: DriveNumber, on: boolean) {
const disk =
document.querySelector('#disk' + drive)! as HTMLElement;
disk.style.backgroundImage =
on ? 'url(css/red-on-16.png)' :
'url(css/red-off-16.png)';
}
public dirty() {
// document.querySelector('#disksave' + drive).disabled = !dirty;
}
public label(drive: DriveNumber, label: string) {
const labelElement =
document.querySelector('#disk-label' + drive)! as HTMLElement;
if (label) {
labelElement.innerText = label;
}
return labelElement.innerText;
}
}