Download src/lib/utils/lifecycle.ts from huggingface/inference-playground: direct link, hf CLI and curl.
- Browser
- Download file 295 Bytes
-
https://huggingface.co/spaces/huggingface/inference-playground/resolve/refs%2Fpr%2F13/src/lib/utils/lifecycle.ts
- Command line
-
hf download hf://spaces/huggingface/inference-playground@refs/pr/13/src/lib/utils/lifecycle.ts
-
curl -L -o lifecycle.ts https://huggingface.co/spaces/huggingface/inference-playground/resolve/refs%2Fpr%2F13/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; | |
| } | |
| }; | |