1.2.5 • Published 2 years ago
yuumi-request v1.2.5
quick start
npm install yuumi-request --saveimport YuumiRequest from 'yuumi-request'
new YuumiRequest({
baseURI: string
headers: Record<string, string>
concurrency: number
timeout: number
// 自定义params格式化函数
paramStringify?: (value: any) => string
// 自定义xhr函数
xhr?: <T>(option: XHR_RequestOption) => Promise<T>
})request
new YuumiRequest().request({
path: string
method: RequestMethod
async?: boolean
headers?: { [key: string]: string }
params?: { [key: string]: number|string|(<number|string>[]) }
data?: any
timeout?: number
cancelToken?: (cancel?: () => void) => void
uploader?: { [key: string]: EventListener }
enforce? : "pre"|"normal"
})get, post, delete, put
new YuumiRequest()['get'](path, params, {
async?: boolean
headers?: { [key: string]: string }
params?: { [key: string]: number|string|(<number|string>[]) }
data?: any
timeout?: number
cancelToken?: (cancel?: () => void) => void
uploader?: { [key: string]: EventListener }
enforce? : "pre"|"normal"
})
new YuumiRequest()['post'|'put'|'delete'](path, data, {
async?: boolean
headers?: { [key: string]: string }
params?: { [key: string]: number|string|(<number|string>[]) }
data?: any
timeout?: number
cancelToken?: (cancel?: () => void) => void
uploader?: { [key: string]: EventListener }
enforce? : "pre"|"normal"
})interceptors
const request = new YuumiRequest()
request.interceptors.request((data: any) => Promise.resolve(data), (reason?: any) => Promise.reject(reason))
request.interceptors.request((data: any) => Promise.resolve(data), (reason?: any) => Promise.reject(reason))1.2.5
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.6
2 years ago
1.1.0-beta
2 years ago
1.0.10
3 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.0
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.1
6 years ago
0.1.0
6 years ago