Better error handling, birthdays, startup otbs, resource caching.

This commit is contained in:
2020-04-15 08:47:13 -07:00
parent 197e4ffc5d
commit 333bd70d1a
13 changed files with 536 additions and 177 deletions
+7
View File
@@ -78,6 +78,7 @@ const unsubscribeNewOrJoinGame = store.subscribe(() => {
});
let autostart = new URL(window.location.href).searchParams.get('autostart');
let rejoin = new URL(window.location.href).searchParams.get('reload-game');
function handleMessage(evt) {
const data = JSON.parse(evt.data),
@@ -86,6 +87,8 @@ function handleMessage(evt) {
if (data.event === 'error') {
console.log('error:' + data.exn);
} else if (data.event === 'new-game-started') {
history.replaceState({}, document.title, '/');
console.log('clearing auto-reload');
initialize(store, Ws.sendCommand);
Ws.setMainOnMessage(handleMessageFarm);
Ws.openSecondary('push-web-socket');
@@ -111,6 +114,10 @@ function handleMessage(evt) {
gameName: data.games.games[0].name }));
}
}
if (rejoin) {
store.dispatch(startOrJoinGame({ type: 'join-as-existing',
gameId: false }));
}
}
}