Comparing version 0.3.5 to 0.3.6
@@ -0,0 +0,0 @@ # Change Log |
@@ -125,2 +125,5 @@ 'use strict'; | ||
}; | ||
EventEmitter.prototype.eventNames = function () { | ||
return this.getEventNames(); | ||
}; | ||
EventEmitter.prototype.destroy = function () { | ||
@@ -127,0 +130,0 @@ this._listenersMap = {}; |
@@ -123,2 +123,5 @@ /*! ***************************************************************************** | ||
}; | ||
EventEmitter.prototype.eventNames = function () { | ||
return this.getEventNames(); | ||
}; | ||
EventEmitter.prototype.destroy = function () { | ||
@@ -125,0 +128,0 @@ this._listenersMap = {}; |
@@ -129,2 +129,5 @@ (function (global, factory) { | ||
}; | ||
EventEmitter.prototype.eventNames = function () { | ||
return this.getEventNames(); | ||
}; | ||
EventEmitter.prototype.destroy = function () { | ||
@@ -131,0 +134,0 @@ this._listenersMap = {}; |
@@ -1,2 +0,4 @@ | ||
import { Listener } from './interface'; | ||
declare type Listener = ((...payload: any) => void) & { | ||
isOnce?: boolean; | ||
}; | ||
export default class EventEmitter { | ||
@@ -11,3 +13,5 @@ private _listenersMap; | ||
getEventNames(): string[]; | ||
eventNames(): string[]; | ||
destroy(): void; | ||
} | ||
export {}; |
@@ -113,2 +113,5 @@ "use strict"; | ||
; | ||
EventEmitter.prototype.eventNames = function () { | ||
return this.getEventNames(); | ||
}; | ||
EventEmitter.prototype.destroy = function () { | ||
@@ -115,0 +118,0 @@ this._listenersMap = {}; |
{ | ||
"name": "any-event", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "🍰 一个mini的事件管理器", | ||
@@ -14,11 +14,11 @@ "keywords": [ | ||
"jsdelivr": "dist/AnyEvent.umd.js", | ||
"main": "lib/main.js", | ||
"module": "dist/AnyEvent.es.js", | ||
"browser": "dist/AnyEvent.umd.js", | ||
"types": "lib/main.d.ts", | ||
"files": [ | ||
"src", | ||
"lib/*", | ||
"dist/*.js", | ||
"types/*.d.ts" | ||
"dist/*.js" | ||
], | ||
"main": "lib/main.js", | ||
"module": "dist/AnyEvent.es.js", | ||
"types": "lib/main.d.ts", | ||
"scripts": { | ||
@@ -41,5 +41,3 @@ "build": "rimraf dist && rimraf lib && tsc && rollup -c", | ||
"@types/jest": "^23.3.5", | ||
"commitizen": "^3.0.5", | ||
"jest": "^23.6.0", | ||
"minor": "^1.2.3", | ||
"rimraf": "^2.6.2", | ||
@@ -46,0 +44,0 @@ "rollup": "^0.67.1", |
@@ -0,0 +0,0 @@ # any-event [![NPM Version][npm-image]][npm-url] [![npm bundle size (minified + gzip)][size-image]][size-url] [![codecov][codecov-image]][codecov-url] [![CircleCI][ci-image]][ci-url] |
@@ -1,2 +0,6 @@ | ||
import { Listener, ListenersMap } from './interface'; | ||
type Listener = ((...payload: any) => void) & { isOnce?: boolean } | ||
interface ListenersMap { | ||
[propName: string]: Listener[]; | ||
} | ||
export default class EventEmitter { | ||
@@ -38,3 +42,3 @@ private _listenersMap: ListenersMap; | ||
* @param {String|Symbol} 事件名 | ||
* @param {Function} 回调函数[可选] | ||
* @param {Function} 回调函数 | ||
*/ | ||
@@ -96,5 +100,5 @@ off(eventName: string, listener?: Listener): EventEmitter { | ||
*/ | ||
getEventNames(){ | ||
const eventNames:string[] = []; | ||
for(let eventName in this._listenersMap) { | ||
getEventNames() { | ||
const eventNames: string[] = []; | ||
for (let eventName in this._listenersMap) { | ||
eventNames.push(eventName); | ||
@@ -106,2 +110,9 @@ } | ||
/** | ||
* getEventNames别名, 为了和node的api一致 | ||
*/ | ||
eventNames() { | ||
return this.getEventNames(); | ||
} | ||
/** | ||
* 销毁实例 | ||
@@ -108,0 +119,0 @@ */ |
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
38302
9
628
12
1