INNER CODE UNIT · TypeScript
main
rio-labs/rio · frontend/code/app.ts:26
async function main(): Promise<void> {
// Browsers have a "duplicate tab" feature which can create 2 tabs that
// share the same session token. We could just try to connect and the server
// would tell us that the session token is in use, but the server is careful
// about rejecting connections and thus might make us wait a while. In order
// to provide a snappier user experience, we'll try to detect a duplicated
// tab and just reload the page.
if (isDuplicatedTab()) {
console.log("Tab appears to have been duplicated; reloading the page");
window.location.reload();
return;
}
// Display a warning if running in debug mode
if (globalThis.RIO_DEBUG_MODE) {
console.warn(
"Rio is running in DEBUG mode.\nDebug mode includes helpful tools" +
" for development, but is slower and disables some safety checks." +