# @camwiegert/typical 中文文档

规范地址：https://npmcn.com/package/%40camwiegert/typical/

版本：0\.1\.1
npm 元数据更新时间：2022-04-04T21:35:32.944Z
中文译文更新时间：2026-11-09T00:58:54.747Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40camwiegert/typical
原文对照：https://npmcn.com/package/%40camwiegert/typical/?lang=original
项目主页：https://github.com/camwiegert/typical
源码仓库：https://github.com/camwiegert/typical

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：8.6 kB，5 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2019-10-15T02:05:18.930Z
- 最新版本发布：2019-10-19T19:32:33.601Z
- 近 30 天下载量：6109（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：2（近 12 个月 0 个）

## 中文简介

动画打入~400字节

## 安装

```sh
npm install @camwiegert/typical
```

也可以使用：`pnpm add @camwiegert/typical`、`yarn add @camwiegert/typical`、`bun add @camwiegert/typical`

## README

# 常规

> 动画打字以~400字节表示: blowfish: of JavaScript.

-   **零依赖关系**
-   **麻省理工学院执照** [→](https://github.com/camwiegert/typical/tree/master/LICENSE)
-   **爱莫吉支持**
-   **智能删除 :** 只删除需要删除的内容
-   **暂停 :** 步骤间暂停
-   **循环 :** 很容易从任意点循环
-   **正在等待中 :** 等待任意的承诺
-   **人类:** 输入速度略有变化

[**民主 ∗**](https://codepen.io/camwiegert/pen/rNNepYo)

* * *

## 安装

```shell
npm install @camwiegert/typical
```

**更多安装选项**

您不用软件包管理器, 可以下载 `typical.js` 从 [GitHub 图像](https://raw.githubusercontent.com/camwiegert/typical/master/typical.js) 并直接从 CDN 从本地导入或直接导入 [(单位:公斤)](https://unpkg.com/@camwiegert/typical)。 。 。 .

## API 密码

```typescript
type(target: HTMLElement, ...steps: any[]) => Promise<void>;
```

模块输出一个函数, `type`,它将目标要素作为其第一个论据,并将任何额外论据作为执行步骤。 其他参数根据类型执行动作:

-   `string` 参数将输入
-   `number` 参数将暂停, 以毫秒计
-   `function` 参数将调用目标元素作为参数
-   `Promise` 参数将等待解析

## 使用量

最基本的使用 `type` 正在提供目标元素和要键入的字符串.

```javascript
import { type } from '@camwiegert/typical';

type(element, 'text');
```

### 暂停

为了在任意一点暂停打字,通过数毫秒暂停.

```javascript
type(element, 'Hello', 1000, 'Hello world!');
```

### 循环

为了循环,通过 `type` 在你想要开始循环的时候 作为自己的参数 可以用别名 `type` 作为 `loop` 明确.

```javascript
import {
    type,
    type as loop
};

const steps = [1000, 'Ready', 1000, 'Set', 1000, 'Go'];

type(element, ...steps, loop);
```

要循环一定数量,请通过多步.

```javascript
type(element, ...steps, ...steps, ...steps);
```

### 等待时

过后a `Promise`, (中文(简体) ), `type` 等它解决后再继续 因为 `type` 本身返回 a `Promise`,这意味着你可以等待一组步骤完成,然后开始另一个步骤.

```javascript
const init = type(target, 'In a moment...', 500);

type(target, init, 'start', 500, 'looping', loop);
```

### 职能

函数参数被传递到目标元素上,可用于在步骤之间运行目标元素. 如果你还回去 `Promise`, (中文(简体) ), `type` 等着它解决.

```javascript
const toggle = (element) =>
    element.classList.toggle('is-typing');

type(target, toggle, 'Type me', toggle);
```

## 支助

-   [x] 颜色
-   [x] 边缘
-   [x] 火花
-   [x] 萨法里
-   [ ] Internet 浏览器

## 常见问题

### @camwiegert/typical 是什么？

动画打入~400字节

### 如何安装 @camwiegert/typical？

在项目目录运行 npm install @camwiegert/typical，或使用 pnpm add / yarn add / bun add。

### @camwiegert/typical 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/camwiegert\_\_typical 是否存在。

### @camwiegert/typical 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @camwiegert/typical 可以商用吗？

@camwiegert/typical 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @camwiegert/typical 的下载量有多少？

根据 npm 官方下载统计，@camwiegert/typical 在 2026/10/09 – 2026/11/07 这 30 天内被下载 6,109 次，日均约 204 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @camwiegert/typical 还在维护吗？

最新版本 0\.1\.1 发布于 2019/10/20（7 年前）；至今共发布 2 个版本，其中过去 12 个月发布了 0 个；首次发布于 2019/10/15。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

