Fixed weird things when window lost focus
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user