npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sofa-asyncdownload

v0.1.4

Published

react asyncDownload component

Downloads

37

Readme

更新至v0.1.4

sofa-asyncdownload

React Async Download component.

开发

npm link


## 发布

```bash
npm run build

npm login

npm publish

安装

npm install sofa-asyncdownload

使用

const statusMap = {
  0: '等待下载',
  1: '正在下载',
  2: '下载失败',
  3: '下载完成',
};
<AsyncDownload
  downloadListId="downloadList"
  url='/test/getdownloadlist'
  processField={'process'}
  statusField={'status'}
  statusMap={statusMap}
  maxCount={10}
  interval={2000}
  width={300}
  fields={['file_name', 'create_time']}
  targetPathField={'donwload_template'}
  successColor={'#219040'} />
pushDownloadQueue('downloadList', '/test/pushToDownloadList', params, true);

API

  1. AsyncDownload组件

    异步下载列表组件,参照使用参数,部分参数可缺省;

  2. pushDownloadQueue函数

    下载操作函数,部分参数可缺省; 参数说明: |参数|类型|说明 |:--:|:-----|:-----|:-----| |downloadListId|string|指定下载操作进入的下载列表组件的id;required |url|string|下载操作的异步接口;required |params|object|接口携带参数: not required |autoCallDownloadList|boolean|加入下载队列成功后是否自动显示下载列表 not required |successMessgae|string|加入下载队列成功后的文案提示 not required |errorMessgae|string|加入下载队列失败后的文案提示 not required

AsyncDownload组件接收的props

|属性|类型|说明 |:--:|:-----|:-----|:-----| |downloadListId|string|下载列表的id;required |url|string|下载列表的接口地址;reuqired |processField|number|代表进度的字段(0-100),缺省代表没有进度功能;not required |statusField|any|代表条目状态的字段,字段值为statusMap的key; required |statusMap|object|状态代表的实际含义;required |maxCount|number|列表显示的最大条数,缺省显示全部;not required |interval|number|在列表显示状态下,轮询的时间间隔,单位是毫秒,缺省表示显示状态下不轮询接口;not required |width|number|列表的宽度;not required |fields|array|列表中展示的字段的数组;not required |targetPathField|string|下载成功后,文件下载连接的字段;required |successColor|string|进度和下载完成的颜色;not required