进展

一个小型的简单零依赖性进度栏组件.

特征
- 零依赖关系: 也不特别与任何框架挂钩.
- 小型: < 500 字节与 Brotli ( < 600 字节 gziped) .
- 易于使用(笑声) (掌声) (掌声) (掌声) (掌声) (掌声) (掌声) (掌声) (掌声) (掌声) (掌声) 而TypeScript类型现在也可用了!
[注] 我们认为这个套装是完成的, 因此我们不接受任何新的功能要求或建议。 请使用问题跟踪器来获取错误报告和安全问题,我们高度重视和欢迎这些问题。 谢谢你的理解
安装
$ npm i @badrap/bar-of-progress
使用量
导入软件包并创建进度栏实例 :
import ProgressBar from "@badrap/bar-of-progress";
const progress = new ProgressBar();
显示进度栏并开始动画 .start() 方法.
progress.start();
说明 默认情况下,当
.start()名为. 相反,有一个80毫秒的宽限期,允许非常快地完成的任务来避免显示进度栏. 您可以修改此( 和其他) 行为, 查看 自定义。 。 。 .
通过调用 .finish() 方法 :
setTimeout(() => {
progress.finish();
}, 1000);
你可以重用一个 progress 实例多次 - 每次 .start() 被称为进步栏 从零开始动画.
自定义
进步栏的外观和行为可以(略)以构造参数定制. 以下是不同的选项及其默认值:
const progress = new ProgressBar({
// The size (height) of the progress bar.
// Numeric values get converted to px.
size: 2,
// Color of the progress bar.
// Also used for the glow around the bar.
color: "#29e",
// Class name used for the progress bar element.
className: "bar-of-progress",
// How many milliseconds to wait before the progress bar
// animation starts after calling .start().
delay: 80,
});
许可证
这个图书馆根据麻省理工学院的许可证颁发执照. 见 自由主义。 。 。 .