类名 common/service/ResponseInterceptor.js
import { Zondy } from '../base'
import { defaultValue } from '../util'

/**
 * 响应拦截器对象
 * @class ResponseInterceptor
 * @moduleEx ServiceModule
 * @param {Object} options 构造参数
 * @param {Function} [options.success(result) = 无] 请求响应成功时会执行的函数
 * @param {Function} [options.failure(result) = 无] 请求响应成功,接口调用失败时会执行的函数
 */
class ResponseInterceptor {
  constructor(options) {
    options = defaultValue(options, {})
    /**
     * 请求响应成功时会执行的函数
     * @member {String} ResponseInterceptor.prototype.success
     * */
    this.success = defaultValue(options.success, undefined)
    /**
     * 请求响应失败时会执行的函数
     * @member {String} ResponseInterceptor.prototype.failure
     * */
    this.failure = defaultValue(options.failure, undefined)
  }
}

Zondy.Service.ResponseInterceptor = ResponseInterceptor
export default ResponseInterceptor
构造函数
成员变量
方法
事件