react-native-promise-rejection-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

react-native-promise-rejection-utils

npm version Dependency Status devDependencies Status npm

Utils for global tracking of unhandled promise rejections.

Installation

$ npm i react-native-promise-rejection-utils

Usage

import {
  getUnhandledPromiseRejectionTracker,
  setUnhandledPromiseRejectionTracker,
} from 'react-native-promise-rejection-utils'
 
const prevTracker = getUnhandledPromiseRejectionTracker()
 
setUnhandledPromiseRejectionTracker((id, error) => {
  console.warn('Unhandled promise rejection!', id, error)
 
  if (prevTracker !== undefined) {
    prevTracker(id, error)
  }
})

Package Sidebar

Install

npm i react-native-promise-rejection-utils

Weekly Downloads

21,008

Version

0.0.1

License

MIT

Unpacked Size

4.66 kB

Total Files

6

Last publish

Collaborators

  • iyegoroff