dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/loud-rejection/api.js
Cyryl Płotnicki 2f946d6200 Add .vscode
2016-09-11 10:29:13 +02:00

33 lines
729 B
JavaScript

'use strict';
var arrayFindIndex = require('array-find-index');
// WARNING: This undocumented API is subject to change.
module.exports = function (process) {
var unhandledRejections = [];
process.on('unhandledRejection', function (reason, p) {
unhandledRejections.push({reason: reason, promise: p});
});
process.on('rejectionHandled', function (p) {
var index = arrayFindIndex(unhandledRejections, function (x) {
return x.promise === p;
});
unhandledRejections.splice(index, 1);
});
function currentlyUnhandled() {
return unhandledRejections.map(function (entry) {
return {
reason: entry.reason,
promise: entry.promise
};
});
}
return {
currentlyUnhandled: currentlyUnhandled
};
};