Comparing version 1.0.1 to 1.0.2
@@ -62,6 +62,6 @@ // The EventEmitter instance will emit its own 'newListener' | ||
} | ||
listener.apply(events, args); | ||
if (once) { | ||
events.removeListener(eventName, listener); | ||
} | ||
listener.apply(events, args); | ||
}; | ||
@@ -368,3 +368,5 @@ listenerFunction.listener = listener; | ||
// emit "NEW_LISTENER" before added | ||
this.emit(NEW_LISTENER); | ||
if (NEW_LISTENER !== eventName) { | ||
this.emit(NEW_LISTENER, eventName, listener); | ||
} | ||
_events[eventName][prependMethod](createListenerFunction(this, eventName, listener, once)); | ||
@@ -371,0 +373,0 @@ this._checkIfMatchMaxListener(eventName); |
@@ -68,6 +68,6 @@ (function (global, factory) { | ||
} | ||
listener.apply(events, args); | ||
if (once) { | ||
events.removeListener(eventName, listener); | ||
} | ||
listener.apply(events, args); | ||
}; | ||
@@ -374,3 +374,5 @@ listenerFunction.listener = listener; | ||
// emit "NEW_LISTENER" before added | ||
this.emit(NEW_LISTENER); | ||
if (NEW_LISTENER !== eventName) { | ||
this.emit(NEW_LISTENER, eventName, listener); | ||
} | ||
_events[eventName][prependMethod](createListenerFunction(this, eventName, listener, once)); | ||
@@ -377,0 +379,0 @@ this._checkIfMatchMaxListener(eventName); |
@@ -300,3 +300,5 @@ 'use strict'; | ||
// emit "NEW_LISTENER" before added | ||
this.emit(const_1.NEW_LISTENER); | ||
if (const_1.NEW_LISTENER !== eventName) { | ||
this.emit(const_1.NEW_LISTENER, eventName, listener); | ||
} | ||
_events[eventName][prependMethod](utils_1.createListenerFunction(this, eventName, listener, once)); | ||
@@ -303,0 +305,0 @@ this._checkIfMatchMaxListener(eventName); |
@@ -61,6 +61,6 @@ 'use strict'; | ||
} | ||
listener.apply(events, args); | ||
if (once) { | ||
events.removeListener(eventName, listener); | ||
} | ||
listener.apply(events, args); | ||
}; | ||
@@ -67,0 +67,0 @@ listenerFunction.listener = listener; |
{ | ||
"name": "tp-events", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Used to obtain the current events parameters and configuration", | ||
"keywords": [ | ||
"events", | ||
"nodejs events" | ||
"nodejs events", | ||
"EventEmitter" | ||
], | ||
@@ -9,0 +10,0 @@ "main": "dist/events.umd.js", |
@@ -1,8 +0,49 @@ | ||
# event | ||
Nodejs event module in web browser! | ||
# tp-events | ||
[![Build Status](https://www.travis-ci.org/typescript-practice/events.svg?branch=master)](https://www.travis-ci.org/typescript-practice/events) | ||
[![Coverage Status](https://coveralls.io/repos/github/typescript-practice/events/badge.svg?branch=master)](https://coveralls.io/github/typescript-practice/events?branch=master) | ||
[![npm version](https://img.shields.io/npm/v/tp-events.svg?style=flat-square)](https://www.npmjs.com/package/tp-events) | ||
[![monthly downloads](https://img.shields.io/npm/dm/tp-events.svg?style=flat-square)](https://www.npmjs.com/package/tp-events) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
[![UNPKG](https://img.shields.io/badge/unpkg.com--green.svg)](https://unpkg.com/tp-events@latest/dist/events.umd.js) | ||
[![liense](https://img.shields.io/github/license/typescript-practice/events.svg)](#/) | ||
将Nodejs中的event模块使用typescript实现一遍. 另外在加上bancemarker | ||
## Intro | ||
Event based JavaScript for the browser with nodejs events api. For more: [Nodejs Events](https://nodejs.org/api/events.html). | ||
## Example | ||
```js | ||
import EventEmitter from 'tp-events' | ||
class MyEmitter extends EventEmitter {} | ||
const myEmitter = new MyEmitter(); | ||
myEmitter.on('event', () => { | ||
console.log('an event occurred!'); | ||
}); | ||
myEmitter.emit('event'); | ||
``` | ||
## Install | ||
[![NPM Badge](https://nodei.co/npm/tp-events.png?downloads=true)](https://www.npmjs.com/package/tp-events) | ||
## API | ||
Please refer to the document on [Node.js v9.6.1 Events](https://nodejs.org/api/events.html), API is the same. | ||
## Development | ||
- `npm t`: Run test suite | ||
- `npm start`: Run `npm run build` in watch mode | ||
- `npm run test:watch`: Run test suite in [interactive watch mode](http://facebook.github.io/jest/docs/cli.html#watch) | ||
- `npm run test:prod`: Run linting and generate coverage | ||
- `npm run build`: Generate bundles and typings, create docs | ||
- `npm run lint`: Lints code | ||
- `npm run commit`: Commit using conventional commit style ([husky](https://github.com/typicode/husky) will tell you to use it if you haven't :wink:) | ||
## Reference | ||
@@ -12,1 +53,5 @@ | ||
- [Olical EventEmitter](https://github.com/Olical/EventEmitter) | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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 7 instances 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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 7 instances in 1 package
2622540
2774
57