aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app.js b/app.js
index 578afb9..3beba3e 100644
--- a/app.js
+++ b/app.js
@@ -238,7 +238,13 @@ function route () {
for (var i=0; i < log.length; i++) {
var post = log[i]
scroller.appendChild(renderMessage(post))
-
+ }
+ // sort log by timestamp and save over -- I don't know how expensive this is, we probably don't want to do this every single time we load the log?
+ var newLog = log.sort(function (a, b) {
+ return b.content.timestamp - a.content.timestamp
+ })
+ if (newLog) {
+ localStorage['log'] = JSON.stringify(newLog)
}
}
}