inputTest.js 383 B

1234567891011121314151617
  1. import { Input } from './../io/input';
  2. export class InputTest extends Input {
  3. constructor (inputList) {
  4. super();
  5. this.inputList = inputList;
  6. }
  7. requestInput (callback) {
  8. if(this.inputList.length <= 0) {
  9. throw new Error('The amount of requests exceeded the amount of available inputs');
  10. } else {
  11. callback(this.inputList.splice(0,1)[0]);
  12. }
  13. }
  14. }