Better error handling, birthdays, startup otbs, resource caching.
This commit is contained in:
@@ -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 }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user