Save State Helper
Persist player progress with namespaced storage that survives theme switches and offline visits.
const storage = window.gameUtils.createStorage('instantgames');
storage.set('highScore', score);
const streak = storage.get('dailyStreak', 0);
Input Debounce
Smooth out rapid keyboard presses for endless runners and high-speed puzzlers.
const handleMove = gameUtils.debounce((direction) => {
board.move(direction);
}, 80);
window.addEventListener('keydown', (event) => {
handleMove(event.key);
});
Router-safe Redirect
Use the same redirect strategy we shipped in _redirects to keep canonical URLs clean across directories.
# _redirects snippet
/index.html / 301!
/blog/index.html /blog/ 301!
/games.html / 301!