Skip to content

Commit da9ce6a

Browse files
committed
Add status
1 parent 4a032c0 commit da9ce6a

File tree

2 files changed

+45
-14
lines changed

2 files changed

+45
-14
lines changed

helpers.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
helpers = {}
22

33
tmp.helpers = [
4-
'p',
5-
'balance',
6-
'rightJust',
7-
'filterByProperty',
8-
'capitalize',
9-
'ls',
10-
'converters',
11-
'newAccount',
12-
'walletFilters',
13-
'unlockAccountByIndex',
4+
"p",
5+
"balance",
6+
"rightJust",
7+
"filterByProperty",
8+
"capitalize",
9+
"ls",
10+
"converters",
11+
"newAccount",
12+
"walletFilters",
13+
"status",
14+
"unlockAccountByIndex",
1415
]
1516

16-
tmp.helpers
17-
.forEach(function(helper) {
18-
loadScript('./helpers/' + helper + '.js')
19-
});
17+
tmp.helpers.forEach(function(helper) {
18+
loadScript("./helpers/" + helper + ".js")
19+
})

helpers/status.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
function date() {
2+
var unix = Math.round(Date.now() / 1000).toString()
3+
4+
var today = new Date()
5+
var _date = today.getDate().toString()
6+
var date = _date.length == 1 ? "0" + _date : _date
7+
var _month = (today.getMonth() + 1).toString()
8+
var month = _month.length == 1 ? "0" + _month : _month
9+
var year = today.getFullYear().toString()
10+
11+
var shortFormat = date + "/" + month + "/" + year
12+
13+
var hours = today.getHours()
14+
var minutes = today.getMinutes()
15+
var seconds = today.getSeconds()
16+
var time = [hours, minutes, seconds].join(":")
17+
18+
var longFormat = shortFormat + " " + time
19+
20+
return {
21+
unix: unix,
22+
shortFormat: shortFormat,
23+
longFormat: longFormat,
24+
}
25+
}
26+
27+
helpers.status = function() {
28+
var currentBlock = eth.syncing.currentBlock
29+
30+
return date().longFormat + " : " + currentBlock
31+
}

0 commit comments

Comments
 (0)