Giter Site home page Giter Site logo

Comments (5)

ibash-corpusant avatar ibash-corpusant commented on August 23, 2024 1

You can polyfill:

// polyfill throwIfAborted which seems to be missing in react-native, but ky
// uses it
//
// Fun fact, AbortSignal here is just a react-native polyfill, too:
// https://github.com/facebook/react-native/blob/838d26d7b534133e75c7fa673dfc849b0e64c9d3/packages/react-native/Libraries/Core/setUpXHR.js#L38
//
// Unfortunately it doesn't have a `reason`
//
// ref: https://github.com/tjmehta/fast-abort-controller/blob/42588908035d1512f90e7299a2c70dfb708f9620/src/FastAbortSignal.ts#L39
if (!AbortSignal.prototype.throwIfAborted) {
AbortSignal.prototype.throwIfAborted = function() {
    if (this.aborted) {
      throw new Error('Aborted')
    }
  }
}

from ky.

sindresorhus avatar sindresorhus commented on August 23, 2024

This is a problem with React Native and should be reported there instead.

from ky.

andredewaard avatar andredewaard commented on August 23, 2024

@psam44 Found a solution?

from ky.

psam44 avatar psam44 commented on August 23, 2024

@andredewaard No solution. My conclusion is to come back to v0.33 for now, and plan for elimination, as supporting this package in react-native doesn't seem to be an objective and I don't expect RN to fully implement the AbortSignal API.

from ky.

andredewaard avatar andredewaard commented on August 23, 2024

Alright, thanks for the heads up, i reverted back to using native Fetch instead.

from ky.

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.