|
@@ -53,3 +53,21 @@ String function JSON_print(model : Element):
|
|
|
result = result + "}"
|
|
|
result = result + "]"
|
|
|
return result!
|
|
|
+
|
|
|
+Void function sleep(timeout : Float):
|
|
|
+ // TODO Placeholder function for a real sleep operation
|
|
|
+ return!
|
|
|
+
|
|
|
+Element function input_timeout(timeout : Float):
|
|
|
+ Float start
|
|
|
+ start = time()
|
|
|
+
|
|
|
+ while (time() - start < timeout):
|
|
|
+ if (has_input()):
|
|
|
+ return input()!
|
|
|
+ else:
|
|
|
+ // Nothing to do, we should yield...
|
|
|
+ sleep(0.01)
|
|
|
+
|
|
|
+ return read_root()!
|
|
|
+
|