UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

28 lines (21 loc) 561 B
'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; };