inputTest.js 493 B

1234567891011121314151617181920
  1. import { Input } from './../io/input';
  2. import { LocalizedStrings } from '../services/localizedStringsService';
  3. export class InputTest extends Input {
  4. constructor (inputList) {
  5. super();
  6. this.index = 0;
  7. this.inputList = inputList;
  8. }
  9. requestInput (callback) {
  10. if(this.index < this.inputList.length) {
  11. callback(this.inputList[this.index]);
  12. this.index++;
  13. } else {
  14. throw new Error(LocalizedStrings.getError("exceeded_input_request"));
  15. }
  16. }
  17. }