wx-request-plus
Version:
增强型微信小程序请求库,支持错误处理、Promise、缓存、弱网处理、请求队列等功能
8 lines (7 loc) • 400 B
TypeScript
import { InterceptorHandlers, InterceptorManager, RequestError } from './types';
export default class Interceptor<T> implements InterceptorManager<T> {
handlers: Array<InterceptorHandlers<T> | null>;
use(fulfilled: (value: T) => T | Promise<T>, rejected?: (error: RequestError) => any): number;
eject(id: number): void;
forEach(fn: (handler: InterceptorHandlers<T>) => void): void;
}