Basic load status checking logic and notify user when lagging

This commit is contained in:
Alex Liebowitz 2016-04-14 02:27:06 -04:00
parent 8deb62cc76
commit 3b705ada7b

View file

@ -17,8 +17,26 @@ var SplashScreen = React.createClass({
message: React.PropTypes.string,
onLoadDone: React.PropTypes.func,
},
updateStatus: function(checkNum=0, was_lagging=false) {
lbry.getDaemonStatus((status) => {
if (status.code == 'started') {
this.props.onLoadDone();
return;
}
if (!was_lagging && status.is_lagging) { // We just started lagging
alert(status.message);
}
if (checkNum < 600) {
setTimeout(() => {
this.updateStatus(checkNum + 1, status.is_lagging);
}, 500);
}
});
},
componentDidMount: function() {
lbry.connect(this.props.onLoadDone);
this.updateStatus();
},
render: function() {
var imgSrc = lbry.imagePath('lbry-white-485x160.png');