aboutsummaryrefslogtreecommitdiff
path: root/src/highscores.js
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2020-04-12 14:42:03 -0500
committerMark Powers <markppowers0@gmail.com>2020-04-12 14:42:03 -0500
commit7e6648902b262484bc0aac824c3784b1ae4b8591 (patch)
treebc56275222a58228fd714af0dad58c660f004ab7 /src/highscores.js
parent1bffb064e2414ced5b1924a4f9fbd822a09c718e (diff)
Update games, add scores
Diffstat (limited to 'src/highscores.js')
-rw-r--r--src/highscores.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/highscores.js b/src/highscores.js
new file mode 100644
index 0000000..e735eee
--- /dev/null
+++ b/src/highscores.js
@@ -0,0 +1,10 @@
+function submitScore(game, score, username){
+ if(username == undefined){
+ username = prompt("Enter a name to submit score", "");
+ }
+ if (!(username == null || username == "")) {
+ const request = new Request(`/setScore?game=${game}&username=${username}&score=${score}`);
+ fetch(request);
+ }
+ return username
+} \ No newline at end of file