1681-engine / index / InputPlayer
Class: InputPlayer<A> ​
Defined in: src/input/inputTape.ts:88
Plays a tape into an Actions: each poll takes the next step from it instead of the devices, and when the tape ends the devices answer again (onEnd says so).
ts
new InputPlayer(tape).playInto(actions, () => console.log('replay over'));Type Parameters ​
| Type Parameter | Default type |
|---|---|
A extends string | string |
Constructors ​
Constructor ​
ts
new InputPlayer<A>(tape): InputPlayer<A>;Defined in: src/input/inputTape.ts:93
Parameters ​
| Parameter | Type |
|---|---|
tape | InputTape |
Returns ​
InputPlayer<A>
Properties ​
tape ​
ts
readonly tape: InputTape;Defined in: src/input/inputTape.ts:93
Accessors ​
done ​
Get Signature ​
ts
get done(): boolean;Defined in: src/input/inputTape.ts:108
Returns ​
boolean
position ​
Get Signature ​
ts
get position(): number;Defined in: src/input/inputTape.ts:104
Steps played so far.
Returns ​
number
Methods ​
playInto() ​
ts
playInto<B>(actions, onEnd?): void;Defined in: src/input/inputTape.ts:127
Drives actions from the tape until it ends; onEnd is called on the poll that finds it over.
Type Parameters ​
| Type Parameter |
|---|
B extends string |
Parameters ​
| Parameter | Type |
|---|---|
actions | Actions<B> |
onEnd? | () => void |
Returns ​
void
read() ​
ts
read(): ReadonlyMap<A, number> | null;Defined in: src/input/inputTape.ts:113
The next step's values, or null once the tape is over.
Returns ​
ReadonlyMap<A, number> | null