diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-16 17:17:52 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-16 17:17:52 +0100 |
| commit | d4b1130931a430395b4172c28130693cc05c77c0 (patch) | |
| tree | f7532919ef301cf338e3712a9d98860610039751 /static/modules/xbox.js | |
| parent | 766251ed6dc1858b544aa1c50de72b93d10b84d4 (diff) | |
| download | deck-it-d4b1130931a430395b4172c28130693cc05c77c0.tar.gz deck-it-d4b1130931a430395b4172c28130693cc05c77c0.zip | |
feat(xbox): switch to the Xbox tab once per game session
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/modules/xbox.js')
| -rw-r--r-- | static/modules/xbox.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/static/modules/xbox.js b/static/modules/xbox.js new file mode 100644 index 0000000..3350f52 --- /dev/null +++ b/static/modules/xbox.js @@ -0,0 +1,28 @@ +// deck-it - the Xbox tab: Xbox Live profile, games, friends and the console +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +const SESSION_KEY = "deckit-xbox-session"; + +// A game session on the Xbox brings this tab forward once and leaves it +// there (app.js reads Infinity as "stay"). The session is remembered, so a +// reload, or leaving the tab, does not bring it back until the next one. +export function sessionPeek(st, store = globalThis.localStorage) { + if (!st.session || store.getItem(SESSION_KEY) === String(st.session)) return 0; + store.setItem(SESSION_KEY, st.session); + return Infinity; +} + +export default { title: "Xbox", tab: "Xbox", interval: 5, peek: (st) => sessionPeek(st) }; |
