miniprogram-network-life-cycle
TypeScript icon, indicating that this package has built-in type declarations

5.3.0-alpha.0 • Public • Published

miniprogram-network-life-cycle npm version

网络请求生命周期

miniprogram-network 底层数据处理流程

  • [x] Promise
  • [x] Cancelable
  • [x] Interceptors in Lifecycle (only one,modify data or status)
    • [x] transform request data
    • [x] transform response data
  • [x] Global Listeners
    • [x] On Send (before request data send & after request data transformed)
    • [x] On Response (after request response data transformed)
    • [x] On rejected (when catch of Promise)
    • [x] On abort
    • [x] On complete
    • [ ] On resolved? (before then of Promise)

API Properties

  • Defaults 全局配置项目
    • transformSend(options: Exclude<FullOptions, 'transformSend' | 'transformResponse'>) => wx.Options | Promise<wx.Options> 发送前转换参数
    • transformResponse(res: wx.SuccessCallbackResult, config: TFullOptions) => any | Promise<any> 数据返回转换参数
  • Listeners 全局事件监听列表
    • [onSend(options: RequestOptions) => any]; 发送前事件监听列表
    • [onResponse(res: wx.RequestSuccessCallbackResult, options: RequestOptions) => any]; 收到服务器响应事件监听列表
    • [onComplete(res: wx.GeneralCallbackResult, options: RequestOptions) => any];每个操作完成事件响应
    • [onReject(res: any | wx.GeneralCallbackResult, options: RequestOptions) => any];操作最终失败响应事件
    • [onAbort(reason: any, options: RequestOptions) => any];取消操作响应事件
  • handle 底层处理函数

LifeCycle

Request Life Cycle

Dependents (3)

Package Sidebar

Install

npm i miniprogram-network-life-cycle

Weekly Downloads

5

Version

5.3.0-alpha.0

License

Apache-2.0

Unpacked Size

111 kB

Total Files

48

Last publish

Collaborators

  • newfuture