aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-07-13 15:35:52 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-07-13 15:35:52 +0200
commit6ea56ebf7e2ee9fc06423ae36ed3b852e7e80948 (patch)
tree3e0b2246175dfdb54669330c9f6653157b1329f4
parentJavascript use strict. (diff)
downloadcalp-6ea56ebf7e2ee9fc06423ae36ed3b852e7e80948.tar.gz
calp-6ea56ebf7e2ee9fc06423ae36ed3b852e7e80948.tar.xz
lol gensym.
-rw-r--r--static/script.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/static/script.js b/static/script.js
index 58642b09..27831f35 100644
--- a/static/script.js
+++ b/static/script.js
@@ -33,11 +33,12 @@ function decimal_time_to_date (time, date) {
}
}
-let gensym_counter = 0;
-function gensym (prefix) {
- gensym_counter++;
- return prefix + gensym_counter;
-}
+/* if only there was such a thing as a let to wrap around my lambda... */
+let gensym = (function(counter) {
+ return function gensym (prefix="gensym") {
+ return prefix + ++counter;
+ }
+})(0);
/* start and end time for calendar page */
let start_time = new Date();