0.0.5 • Published 2 years ago

@axios-plugin/throttle v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@axios-plugin/throttle

限制axios发送请求的频率,避免过多的请求对服务器造成负担或浪费带宽资源。

安装

yarn add @axios-plugin/throttle

使用

import { ThrottlePlugin } from '@axios-plugin/throttle'

axiosInstance = 
  pluginify(axios.create() as AxiosStatic).use(new ThrottlePlugin({ maxTime: 1000 }).generate()

参数

new ThrottlePlugin() //默认是 500ms 内,不会重发请求
new ThrottlePlugin({ maxTime: 1000 }) // 1s

注意

在使用 TimeoutPlugin 时,首先需要使用 pluginify 将 axios变成基于插件的请求库. pluginify 内置在 @axios-plugin/core 中.

0.0.5

2 years ago

0.0.4

2 years ago

0.0.2-alpha.0

2 years ago