Comparing version 2.0.1 to 2.0.2-alpha.0
@@ -8,3 +8,3 @@ export interface DefaultTypeAndEventMap { | ||
export interface Interceptor { | ||
(context: any, next: () => void): void; | ||
(type: string | number | symbol, next: () => void): void; | ||
} | ||
@@ -35,3 +35,3 @@ export default class AnyEvent<TypeAndEventMap extends DefaultTypeAndEventMap = DefaultTypeAndEventMap> { | ||
*/ | ||
emit<Key extends keyof TypeAndEventMap>(type: Key, payload?: TypeAndEventMap[Key]): void; | ||
emit<Key extends keyof TypeAndEventMap>(type: Key, payload?: TypeAndEventMap[Key], callback?: () => void): void; | ||
private __emit; | ||
@@ -38,0 +38,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import{__values as t}from"tslib";var r=function(){function r(){this.__map={}}return r.prototype.beforeEach=function(t){this.__interceptor=t},r.prototype.on=function(r,i){var e,o,n=Array.isArray(r)?r:[r];try{for(var a=t(n),_=a.next();!_.done;_=a.next()){var f=_.value;this.__map[f]=this.__map[f]||[];var p=this.__map[f];p&&p.push(i)}}catch(t){e={error:t}}finally{try{_&&!_.done&&(o=a.return)&&o.call(a)}finally{if(e)throw e.error}}return this},r.prototype.emit=function(t,r){var i=this;void 0!==this.__interceptor?this.__interceptor(this,(function(){i.__emit(t,r)})):this.__emit(t,r)},r.prototype.__emit=function(r,i){var e,o,n=this.__map[r];if(Array.isArray(n)&&(null==n?void 0:n.length))try{for(var a=t(n),_=a.next();!_.done;_=a.next()){(0,_.value)(i)}}catch(t){e={error:t}}finally{try{_&&!_.done&&(o=a.return)&&o.call(a)}finally{if(e)throw e.error}}this.event=i},r.prototype.off=function(t,r){var i=this.__map[t];if(void 0!==i)if(void 0===r)delete this.__map[t];else{var e=i.findIndex((function(t){return t===r}));i.splice(e,1)}},r.prototype.destroy=function(){this.__map={}},r}();export{r as default}; | ||
import{__values as t,__assign as r}from"tslib";var e=function(){function e(){this.__map={}}return e.prototype.beforeEach=function(t){this.__interceptor=t},e.prototype.on=function(r,e){var i,o,n=Array.isArray(r)?r:[r];try{for(var a=t(n),_=a.next();!_.done;_=a.next()){var p=_.value;this.__map[p]=this.__map[p]||[];var f=this.__map[p];f&&f.push(e)}}catch(t){i={error:t}}finally{try{_&&!_.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}return this},e.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())},e.prototype.__emit=function(e,i){var o,n,a=this.__map[e];if(Array.isArray(a)&&(null==a?void 0:a.length))try{for(var _=t(a),p=_.next();!p.done;p=_.next()){(0,p.value)(i)}}catch(t){o={error:t}}finally{try{p&&!p.done&&(n=_.return)&&n.call(_)}finally{if(o)throw o.error}}this.event=r(r({},i),{__type:e})},e.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)}},e.prototype.destroy=function(){this.__map={}},e}();export{e as default}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,1 +0,1 @@ | ||
"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){var e=this;void 0!==this.__interceptor?this.__interceptor(this,(function(){e.__emit(t,r)})):this.__emit(t,r)},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)}}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; | ||
"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,n,o=Array.isArray(r)?r:[r];try{for(var _=t.__values(o),a=_.next();!a.done;a=_.next()){var s=a.value;this.__map[s]=this.__map[s]||[];var p=this.__map[s];p&&p.push(e)}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=_.return)&&n.call(_)}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,n,o=this.__map[r];if(Array.isArray(o)&&(null==o?void 0:o.length))try{for(var _=t.__values(o),a=_.next();!a.done;a=_.next()){(0,a.value)(e)}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=_.return)&&n.call(_)}finally{if(i)throw i.error}}this.event=t.__assign(t.__assign({},e),{__type:r})},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; |
{ | ||
"name": "any-event", | ||
"version": "2.0.1", | ||
"version": "2.0.2-alpha.0", | ||
"description": "小巧的事件模型", | ||
@@ -20,5 +20,5 @@ "main": "dist/index.js", | ||
"author": "any86", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"gitHead": "70596c3e83bfd8b134cd1975cdf92117fb326d6d" | ||
"gitHead": "05b7cc6e0af8a0018f7edfe0c0ac8a4843a65441" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
9511
0
2