Preact Videoterm

This commit is contained in:
Will Scullin 2022-06-15 18:44:58 -07:00
parent 375b4bb1d5
commit efe8594845
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD
2 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import { Screen } from './Screen';
import { Drives } from './Drives';
import { Slinky } from './Slinky';
import { ThunderClock } from './ThunderClock';
import { Videoterm } from './Videoterm';
import { spawn, Ready } from './util/promises';
import styles from './css/Apple2.module.css';
@ -87,6 +88,7 @@ export const Apple2 = (props: Apple2Props) => {
<div className={cs(styles.outer, { apple2e: e, [styles.ready]: ready })}>
<Screen screen={screen} />
<Slinky io={io} slot={2} />
{!e ? <Videoterm io={io} slot={3} /> : null}
<Mouse cpu={cpu} screen={screen} io={io} slot={4} />
<ThunderClock io={io} slot={5} />
<Inset>

View File

@ -0,0 +1,20 @@
import { useEffect } from 'preact/hooks';
import Apple2IO, { slot } from 'js/apple2io';
import VideotermImpl from 'js/cards/videoterm';
/**
* VideoTerm component properties
*/
export interface VideotermProps {
io: Apple2IO | undefined;
slot: slot;
}
export const Videoterm = ({ io, slot }: VideotermProps ) => {
useEffect(() => {
if (io) {
const videoterm = new VideotermImpl();
io.setSlot(slot, videoterm);
}
}, [io, slot]);
return null;
};