Sunny-Kid / axios-last

Solution for taking the last value from multiple calls

Home Page:https://leftstick.github.io/axios-last

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

axios-last

NPM version

Solution for taking the last value from multiple calls

Install

yarn

yarn add axios-last

npm

npm install --save axios-last

Import

ES2015

import { create } from 'axios-last'

CommonJS

const { create } = require('axios-last')

Usage

import { create } from 'axios-last'

const request = create()

for (let i = 0; i < 3; i++) {
  request({
    method: 'GET',
    url: 'https://test.com/users',
    params: {
      name: i
    }
  }).then(res => {
    // only request with name === 2 received
    // all previous requests were cancelled while subsequent made
  })
}

LICENSE

MIT License

About

Solution for taking the last value from multiple calls

https://leftstick.github.io/axios-last

License:MIT License


Languages

Language:JavaScript 70.5%Language:TypeScript 29.5%