kiss-spaced-rep refresh flow

This commit is contained in:
2023-04-12 09:54:09 -06:00
parent 7c32b57038
commit 1d140d38ae
4 changed files with 12 additions and 4 deletions

View File

@@ -27,4 +27,6 @@
(cc))
(method :Void getUserInput [resolve]
(resolve (.readLine (Sys.stdin))))
(resolve (.readLine (Sys.stdin))))
(method :Void promptForRefresh [:Void->Void refresh] null)

View File

@@ -169,6 +169,7 @@
{
(engine.clear)
(engine.println "All cards studied")
(engine.promptForRefresh ->(studyAll engine))
}))
(defReaderMacro ["*" "?"] [stream &builder b]

View File

@@ -7,6 +7,7 @@ interface StudyEngine {
function print(s:String):Void;
function println(s:String):Void;
function showImage(s:String):Void;
function delayForUserInput(cc:Continuation):Void;
function delayForUserInput(cc:Continuation, ?text:String):Void;
function getUserInput(resolve:String->Void):Void;
function promptForRefresh(refresh:Void->Void):Void;
}

View File

@@ -43,11 +43,15 @@
(method :Void showImage [path]
(+= content "<img src=\"/static/${path}\" /><br />"))
(method :Void delayForUserInput [cc]
(method :Void delayForUserInput [cc &opt :String text]
(set this.cc cc)
(+= content "<br /><a href=\"/continue\">Next</a><br />"))
(unless text
(set text "Next"))
(+= content "<br /><a href=\"/continue\">${text}</a><br />"))
(method :Void getUserInput [resolve]
(set this.resolve resolve)
(+= content "<br /><input type=\"text\" id=\"value\"><br /><button onclick=\"window.open('/submit?value=' + document.getElementById('value').value, '_self');\">Submit</a><br />"))
(method :Void promptForRefresh [refresh]
(delayForUserInput refresh "Refresh"))