From: Carl Worth <cworth@cworth.org>
Date: Thu, 21 May 2020 17:10:13 +0000 (-0700)
Subject: Add an "lmno_" prefix to our loadend functions
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=b6ef2233053dc2e9d24fdfacfbf06ed210680db7;p=lmno.games

Add an "lmno_" prefix to our loadend functions

This gives a more natural binding between, for example, lmno_join and
lmno_join_loadend.
---

diff --git a/lmno.js b/lmno.js
index 0e961b0..4af9878 100644
--- a/lmno.js
+++ b/lmno.js
@@ -11,7 +11,7 @@ ${message}
   message_area.insertAdjacentHTML('beforeend', message);
 }
 
-function join_loadend(request, game_id) {
+function lmno_join_loadend(request, game_id) {
   if (request.status === 404) {
     add_message("danger", game_id + " is not a valid game ID. Try again.");
     return;
@@ -25,7 +25,7 @@ function lmno_join(form) {
   const game_id = form.id.value;
 
   var request = new XMLHttpRequest();
-  request.addEventListener("loadend", () => join_loadend(request, game_id));
+  request.addEventListener("loadend", () => lmno_join_loadend(request, game_id));
 
   request.open("GET", "/" + game_id);
   request.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
@@ -34,7 +34,7 @@ function lmno_join(form) {
   form.reset();
 }
 
-function new_loadend() {
+function lmno_new_loadend() {
   if (this.status == 200) {
     /* Response contains the game ID which we simply point the browser to. */
     const game_id = JSON.parse(this.response);
@@ -47,7 +47,7 @@ function new_loadend() {
 
 function lmno_new(engine) {
   const request = new XMLHttpRequest();
-  request.addEventListener("loadend", new_loadend);
+  request.addEventListener("loadend", lmno_new_loadend);
 
   request.open("POST", "/new/" + engine);
   request.setRequestHeader("Content-Type", "application/json; charset=UTF-8");