git ssb

16+

Dominic / patchbay



Tree: 18524fccf4dfb71af2ebb049d12b40ba308d6e1b

Files: 18524fccf4dfb71af2ebb049d12b40ba308d6e1b / modules / timestamp.js

468 bytesRaw
1var h = require('hyperscript')
2var moment = require('moment')
3
4function updateTimestampEl(el) {
5 el.firstChild.nodeValue = moment(el.timestamp).fromNow()
6 return el
7}
8
9setInterval(function () {
10 var els = [].slice.call(document.querySelectorAll('.timestamp'))
11 els.forEach(updateTimestampEl)
12}, 60e3)
13
14exports.message_meta = function (msg) {
15 return updateTimestampEl(h('a.enter.timestamp', {
16 href: '#'+msg.key,
17 timestamp: msg.value.timestamp
18 }, ''))
19}
20

Built with git-ssb-web