This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/currently-unhandled/browser.js
2019-08-11 20:48:02 +02:00

27 lines
561 B
JavaScript

'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) {
w = w || window;
var c = core();
w.addEventListener('unhandledrejection', function (event) {
event = unwrapEvent(event);
c.onUnhandledRejection(event.reason, event.promise);
});
w.addEventListener('rejectionhandled', function (event) {
event = unwrapEvent(event);
c.onRejectionHandled(event.promise);
});
return c.currentlyUnhandled;
};