Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. var core = require('./core');
  3. function unwrapEvent(event) {
  4. if (event && event.detail && event.detail.promise) {
  5. return event.detail;
  6. }
  7. return event;
  8. }
  9. module.exports = function (w) {
  10. w = w || window;
  11. var c = core();
  12. w.addEventListener('unhandledrejection', function (event) {
  13. event = unwrapEvent(event);
  14. c.onUnhandledRejection(event.reason, event.promise);
  15. });
  16. w.addEventListener('rejectionhandled', function (event) {
  17. event = unwrapEvent(event);
  18. c.onRejectionHandled(event.promise);
  19. });
  20. return c.currentlyUnhandled;
  21. };