Spaces:
Paused
Paused
Download src/lib/utils/lifecycle.ts from Nymbo/inference-playground: direct link, hf CLI and curl.
- Browser
- Download file 295 Bytes
-
https://huggingface.co/spaces/Nymbo/inference-playground/resolve/main/src/lib/utils/lifecycle.ts
- Command line
-
hf download hf://spaces/Nymbo/inference-playground/src/lib/utils/lifecycle.ts
-
curl -L -o lifecycle.ts https://huggingface.co/spaces/Nymbo/inference-playground/resolve/main/src/lib/utils/lifecycle.ts
295 Bytes
| import { onDestroy, onMount } from "svelte"; | |
| export const safeOnMount = (fn: (...args: unknown[]) => unknown) => { | |
| try { | |
| onMount(fn); | |
| } catch { | |
| return fn; | |
| } | |
| }; | |
| export const safeOnDestroy = (fn: (...args: unknown[]) => unknown) => { | |
| try { | |
| onDestroy(fn); | |
| } catch { | |
| return fn; | |
| } | |
| }; | |