Spaces:
Sleeping
Sleeping
Download src/lazyWrapper.jsx from randome-games/proxy: direct link, hf CLI and curl.
- Browser
- Download file 422 Bytes
-
https://huggingface.co/spaces/randome-games/proxy/resolve/main/src/lazyWrapper.jsx
- Command line
-
hf download hf://spaces/randome-games/proxy/src/lazyWrapper.jsx
-
curl -L -o lazyWrapper.jsx https://huggingface.co/spaces/randome-games/proxy/resolve/main/src/lazyWrapper.jsx
422 Bytes
| import { lazy } from 'react'; | |
| import NProgress from 'nprogress'; | |
| const lazyWrapper = (importFn) => { | |
| return lazy(() => { | |
| NProgress.start(); | |
| return importFn() | |
| .then((module) => { | |
| NProgress.done(); | |
| return module; | |
| }) | |
| .catch((err) => { | |
| NProgress.done(); | |
| console.error('Lazy loading failed:', err); | |
| throw err; | |
| }); | |
| }); | |
| }; | |
| export default lazyWrapper; | |