12345678910111213141516171819202122232425262728 |
- import { Input } from './../io/input';
- import { LocalizedStrings } from '../services/localizedStringsService';
- export class InputAssessment extends Input {
- constructor (input_list) {
- super();
- this.index = 0;
- this.input_list = input_list.map((val) => {
- return {"value": val, "read": false};
- });
- }
- requestInput (callback) {
- if(this.index < this.input_list.length) {
- const input = this.input_list[this.index];
- input.read = true;
- this.index += 1;
- callback(input.value);
- } else {
- throw new Error(LocalizedStrings.getError("exceeded_input_request"));
- }
- }
- isInputAvailable () {
- return this.index < this.input_list.length;
- }
- }
|