currently-unhandled
Advanced tools
Comparing version 0.3.0 to 0.4.0
'use strict'; | ||
var core = require('./core'); | ||
function unwrapEvent(event) { | ||
if (event && event.detail && event.detail.promise) { | ||
return event.detail; | ||
} | ||
return event; | ||
} | ||
module.exports = function (w) { | ||
@@ -9,2 +17,3 @@ w = w || window; | ||
w.addEventListener('unhandledrejection', function (event) { | ||
event = unwrapEvent(event); | ||
c.onUnhandledRejection(event.reason, event.promise); | ||
@@ -14,2 +23,3 @@ }); | ||
w.addEventListener('rejectionhandled', function (event) { | ||
event = unwrapEvent(event); | ||
c.onRejectionHandled(event.promise); | ||
@@ -16,0 +26,0 @@ }); |
{ | ||
"name": "currently-unhandled", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Track the list of currently unhandled promise rejections.", | ||
@@ -33,2 +33,3 @@ "license": "MIT", | ||
"ava": "^0.15.1", | ||
"bluebird": "^3.4.0", | ||
"browserify": "^13.0.1", | ||
@@ -41,2 +42,3 @@ "coveralls": "^2.11.9", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-mocha": "^1.0.1", | ||
@@ -61,2 +63,5 @@ "mocha": "^2.5.3", | ||
"xo": { | ||
"ignores": [ | ||
"browser-bluebird-test.js" | ||
], | ||
"envs": [ | ||
@@ -63,0 +68,0 @@ "browser", |
@@ -38,4 +38,8 @@ # currently-unhandled [![Build Status](https://travis-ci.org/jamestalmage/currently-unhandled.svg?branch=master)](https://travis-ci.org/jamestalmage/currently-unhandled) [![Coverage Status](https://coveralls.io/repos/github/jamestalmage/currently-unhandled/badge.svg?branch=master)](https://coveralls.io/github/jamestalmage/currently-unhandled?branch=master) | ||
## Browser Support | ||
This module can be bundled with `browserify`. At time of writing, it will work with native Promises in the Chrome browser only. For best cross-browser support, use `bluebird` instead of native Promise support in browsers. | ||
## License | ||
MIT © [James Talmage](http://github.com/jamestalmage) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5545
57
45
16