Giter VIP home page Giter VIP logo

Comments (2)

chenjsh36 avatar chenjsh36 commented on August 21, 2024 1

假取消优点是什么?axios和fetch都可以做到终止请求的,所以我不理解为什么要用已经撤销了的方案?

axios和fetch都可以做到终止请求吗?说对了一半, axios 是基于 XMLHttpRequest,而 XMLHttpRequest 提供 abort API,而原生 fetch 并不提供取消请求的能力,而取消请求在请求场景属于比较通用的能力,所以我们实现了一个伪取消请求能力。

为什么用一个已经撤销的方案?取消请求的设计是基于 proposal-cancelable-promises 这个方案上去实现,虽然方案被撤销了,但其设计有其合理和规范。

为什么不用 AbortController ?因为目前还处于实验阶段,暂时无法在生产环境下使用。

from umi-request.

rickythink avatar rickythink commented on August 21, 2024

是的,正确的用法不是用AbortController么.

不过AbortController支持度还有点问题

from umi-request.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.