aboutsummaryrefslogtreecommitdiff
path: root/src/highscores.js
diff options
context:
space:
mode:
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