diff options
| author | Ev Bogue <ev@evbogue.com> | 2019-04-07 19:44:13 -0500 | 
|---|---|---|
| committer | Ev Bogue <ev@evbogue.com> | 2019-04-07 19:44:13 -0500 | 
| commit | 6d7db0505da8dc75bc00d872b833b650734ad84c (patch) | |
| tree | c58671d20cba1ad5defc6d5f24fa5397b7e2e374 | |
| parent | 265680149ccdb989ba6af214c72ea79bb59dc703 (diff) | |
sort log by chronological order
| -rw-r--r-- | app.js | 8 | 
1 files changed, 7 insertions, 1 deletions
| @@ -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)        }      }    } | 
