Download client/src/shared/core/activitySession.ts from dqy08/InfoLens: direct link, hf CLI and curl.
- Browser
- Download file 443 Bytes
-
https://huggingface.co/spaces/dqy08/InfoLens/resolve/main/client/src/shared/core/activitySession.ts
- Command line
-
hf download hf://spaces/dqy08/InfoLens/client/src/shared/core/activitySession.ts
-
curl -L -o activitySession.ts https://huggingface.co/spaces/dqy08/InfoLens/resolve/main/client/src/shared/core/activitySession.ts
443 Bytes
| /** | |
| * 各页入口注册 isBusy;心跳 tick 用 isSessionActive() = 可见 || getter()。 | |
| */ | |
| let pageBusyGetter: (() => boolean) | undefined; | |
| export function registerPageBusy(getter: () => boolean): void { | |
| pageBusyGetter = getter; | |
| } | |
| export function isSessionActive(): boolean { | |
| if (typeof document !== 'undefined' && document.visibilityState === 'visible') { | |
| return true; | |
| } | |
| return pageBusyGetter?.() ?? false; | |
| } | |