3 lines
1.2 KiB
JavaScript
3 lines
1.2 KiB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=function(){function r(){this.__map={}}return r.prototype.beforeEach=function(t){this.__interceptor=t},r.prototype.on=function(r,e){var i,o,n=Array.isArray(r)?r:[r];try{for(var a=t.__values(n),_=a.next();!_.done;_=a.next()){var s=_.value;this.__map[s]=this.__map[s]||[];var p=this.__map[s];p&&p.push(e)}}catch(t){i={error:t}}finally{try{_&&!_.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}return this},r.prototype.emit=function(t,r,e){var i=this;void 0!==this.__interceptor?this.__interceptor(t,(function(){i.__emit(t,r),e&&e()})):(this.__emit(t,r),e&&e())},r.prototype.__emit=function(r,e){var i,o,n=this.__map[r];if(Array.isArray(n)&&(null==n?void 0:n.length))try{for(var a=t.__values(n),_=a.next();!_.done;_=a.next()){(0,_.value)(e,r)}}catch(t){i={error:t}}finally{try{_&&!_.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}this.event=e},r.prototype.off=function(t,r){var e=this.__map[t];if(void 0!==e)if(void 0===r)delete this.__map[t];else{var i=e.findIndex((function(t){return t===r}));e.splice(i,1)}},r.prototype.destroy=function(){this.__map={}},r}();exports.default=r;
|
|
//# sourceMappingURL=index.js.map
|