UNPKG

axios-queue-js

Version:

axios-queue-js is a lightweight wrapper of axios that enables you to make requests using a queue

23 lines (22 loc) 1.05 kB
import { AxiosInstance, AxiosResponse } from 'axios'; import { IAxiosConfig, IAxiosQueueManager } from './interfaces'; export interface IAxiosQueueManagerProps { client?: AxiosInstance; queueSize?: number; } declare class AxiosQueueManager implements IAxiosQueueManager { private client; private maxQueueSize; private currentQueueSize; private enqueuedTasks; constructor({ queueSize, client }?: IAxiosQueueManagerProps); private makeRequests; private checkAndRunTasks; private createTask; get<T = any, R = AxiosResponse<T>>(url: string, config?: IAxiosConfig): Promise<R>; delete<T = any, R = AxiosResponse<T>>(url: string, config?: IAxiosConfig): Promise<R>; post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: IAxiosConfig): Promise<R>; patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: IAxiosConfig): Promise<R>; put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: IAxiosConfig): Promise<R>; } export default AxiosQueueManager;