Fixed weird things when window lost focus

This commit is contained in:
Klemek
2019-01-08 08:14:27 +01:00
parent 701a53b3f1
commit bfe9a4623e
2 changed files with 11 additions and 0 deletions
+7
View File
@@ -101,6 +101,9 @@ const socket = io({
});
socket.on('connect', function () {
console.log('connected');
$(window).focus(function () {
socket.emit('history', current);
});
});
socket.on('disconnect', function () {
console.log('disconnected');
@@ -114,6 +117,10 @@ socket.on('info', function (res) {
drawGame()
});
socket.on('history', function (h) {
history = h;
});
socket.on('players', function (p) {
players = p;
});