'use strict'; function Handler(name) { this.name = name; this.handler_function_list = []; } /* add a handler_function to the internal handler_function_list. A handler_function tries every time it is invoked, to get a certain subsystem into a certain *fixed* state. When it succeeded, it return an empty string "". if it not (yet) acomplished its goal it will return: * The name of the state it waits for. * undefined, when it does not know, what state to wait for. It is important to feed it back, the wait_state_name it returned last time, so it knows, it should not do any action, while waiting for a certain state. */ Handler.prototype.add = function(func) { this.handler_function_list.push(func); } /* run each handler_function in the handler_function_list until either all of them return the empty string "" or the timeout occured. */ Handler.prototype.run = function(timeout) { console.out(this.name+":start"); var rc = []; var start_date = new Date(); while (!timeout || (new Date()-start_date)