inputTest.js 581 B

1234567891011121314151617181920212223
  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 () {
  10. const promise = new Promise( (resolve, reject) => {
  11. if(this.index < this.inputList.length) {
  12. resolve(this.inputList[this.index]);
  13. this.index++;
  14. } else {
  15. reject(new Error(LocalizedStrings.getError("exceeded_input_request")));
  16. }
  17. });
  18. return promise
  19. }
  20. }