Ethereum network status dashboard for PoW and PoA networks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ethstats-server/public/js/controllers.js

16 lines
460 B

10 years ago
'use strict';
/* Controllers */
function StatsCtrl($scope, socket, _) {
10 years ago
// Socket listeners
// ----------------
socket.on('init', function(data){
$scope.nodes = data.nodes;
$scope.nodesTotal = $scope.nodes.length;
$scope.nodesActive = _.filter($scope.nodes, function(node){ return node.stats.active == true; }).length;
$scope.bestBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.height); }).stats.block.height;
10 years ago
});
}