Download src/services/tips/tipHistory.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 601 Bytes
-
https://huggingface.co/chenbhao/codev/resolve/main/src/services/tips/tipHistory.ts
- Command line
-
hf download hf://chenbhao/codev/src/services/tips/tipHistory.ts
-
curl -L -o tipHistory.ts https://huggingface.co/chenbhao/codev/resolve/main/src/services/tips/tipHistory.ts
601 Bytes
| import { getGlobalConfig, saveGlobalConfig } from '../../utils/config.js' | |
| export function recordTipShown(tipId: string): void { | |
| const numStartups = getGlobalConfig().numStartups | |
| saveGlobalConfig(c => { | |
| const history = c.tipsHistory ?? {} | |
| if (history[tipId] === numStartups) return c | |
| return { ...c, tipsHistory: { ...history, [tipId]: numStartups } } | |
| }) | |
| } | |
| export function getSessionsSinceLastShown(tipId: string): number { | |
| const config = getGlobalConfig() | |
| const lastShown = config.tipsHistory?.[tipId] | |
| if (!lastShown) return Infinity | |
| return config.numStartups - lastShown | |
| } | |