# @ecoding/helper.dynamic

> dev local storage

Latest version **0.0.7** (published 2025-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ecoding/helper.dynamic
pnpm add @ecoding/helper.dynamic
yarn add @ecoding/helper.dynamic
bun add @ecoding/helper.dynamic
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2025-11-04 |
| First published | 2022-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | cxc |
| Maintainers | w3cwhy, hongzheng666 |

## Links

- npm: https://www.npmjs.com/package/@ecoding/helper.dynamic
- npm.io page: https://npm.io/package/@ecoding/helper.dynamic

## Recent versions

- 0.0.7 (latest) — 2025-11-04
- 0.0.6 — 2023-09-06
- 0.0.5 — 2022-10-31
- 0.0.4 — 2022-10-28
- 0.0.3 — 2022-09-29
- 0.0.2 — 2022-09-29
- 0.0.1 — 2022-09-29

## README

# `@ecoding/helper.dynamic`

> TODO: description

## Usage

```javascript
// @/utils/http/dynamic-module.ts
import { dynamicModule } from "@ecoding/helper.dynamic";
import type { LottiePlayer } from "lottie-web";
const modules = {
    lottie: () => import(/* webpackChunkName: "lottie" */ "lottie-web/build/player/lottie_svg")
};

dynamicModule.setModules(modules);
export type TypeLottieAsync = LottiePlayer;
export { dynamicModule } from "@ecoding/helper.dynamic";


// app.ts
import React, { useEffect, useRef } from "react";
import env from "@ecoding/helper.env";
import { TypeLottieAsync, dynamicModule } from "@/utils/http/dynamic-module";

let lottieAsync: Promise<TypeLottieAsync>;

if (env.isWeb) {
    lottieAsync = dynamicModule.execute("lottie");
}
const C: React.FC = () => {
    const refDiv = useRef<HTMLDivElement>(null);

    useEffect(() => {
        lottieAsync.then((lottie) => {
            lottie.setQuality("low");
            const dom = lottie.loadAnimation({
                path: "https://gw.alipayobjects.com/os/finxbff/e502590c-dd48-4566-9ef1-55bdd47510de/b490fcbf-8fbe-4a3b-87c6-3a70032459ba.json",
                container: refDiv.current!,
                loop: false,
                autoplay: false
            });
            dom.setDirection(1);
            dom.goToAndPlay(0, true);
            dom.removeEventListener("complete");
            dom.addEventListener("complete", () => {
                console.log("done");
            });
        });
    }, []);

    return (
        <div>
            <div ref={refDiv} style={{ height: 200, width: 200 }}>
                ddd
            </div>
        </div>
    );
};

export default C;
```

---
_Source: https://npm.io/package/@ecoding/helper.dynamic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
