middlemitter
Advanced tools
Comparing version 1.0.1 to 2.0.0
{ | ||
"name": "middlemitter", | ||
"version": "1.0.1", | ||
"main": "build/index.js", | ||
"version": "2.0.0", | ||
"main": "build/middlemitter.js", | ||
"module": "build/middlemitter.es.js", | ||
"author": "smbeiragh <smbeiragh@gmail.com>", | ||
@@ -22,9 +23,14 @@ "keywords": [ | ||
"scripts": { | ||
"test": "mocha --require babel-register", | ||
"start": "", | ||
"babel": "./node_modules/.bin/babel src --out-dir build", | ||
"serve": "babel src --out-dir build --watch", | ||
"prepare": "yarn run babel", | ||
"prepublishOnly": "yarn run babel" | ||
"test": "NODE_ENV=test nyc mocha", | ||
"coverage": "NODE_ENV=test nyc --reporter lcov --reporter text mocha", | ||
"rollup": "NODE_ENV=production rollup -c", | ||
"lint": "eslint src test", | ||
"lint:fix": "eslint src test --fix", | ||
"prepare": "yarn run rollup", | ||
"prepublishOnly": "yarn run rollup" | ||
}, | ||
"files": [ | ||
"build/middlemitter.js", | ||
"build/middlemitter.es.js" | ||
], | ||
"engines": { | ||
@@ -34,8 +40,8 @@ "node": ">=6" | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-istanbul": "^4.1.6", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-register": "^6.26.0", | ||
@@ -48,7 +54,9 @@ "chai": "^4.1.2", | ||
"eslint-plugin-react": "^7.5.1", | ||
"mocha": "^4.0.1" | ||
"mocha": "^5.1.1", | ||
"nyc": "^11.7.3", | ||
"rollup": "^0.58.2", | ||
"rollup-plugin-babel": "^3.0.4", | ||
"rollup-plugin-uglify": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0" | ||
} | ||
"dependencies": {} | ||
} |
@@ -5,2 +5,7 @@ # middlemitter | ||
[![Build Status](https://travis-ci.org/smbeiragh/middlemitter.svg?branch=master)](https://travis-ci.org/smbeiragh/middlemitter) | ||
[![codecov](https://codecov.io/gh/smbeiragh/middlemitter/branch/master/graph/badge.svg)](https://codecov.io/gh/smbeiragh/middlemitter) | ||
[![NPM](https://nodei.co/npm/middlemitter.png)](https://nodei.co/npm/middlemitter/) | ||
1. async middlewares | ||
@@ -10,2 +15,6 @@ 2. async/sync event listeners | ||
## Environment | ||
Every ES5 compliant environment + Promise Api & Symbol.iterator. | ||
In case of unsupported environments you can use appropriate polyfill(s). | ||
## Installation | ||
@@ -15,3 +24,3 @@ | ||
``` | ||
```bash | ||
yarn add middlemitter | ||
@@ -21,3 +30,3 @@ ``` | ||
``` | ||
```bash | ||
npm install middlemitter | ||
@@ -29,3 +38,3 @@ ``` | ||
Importing | ||
``` | ||
```js | ||
import { MiddlEmitter } from 'middlemitter'; | ||
@@ -37,3 +46,3 @@ | ||
Add/Remove listener on test event | ||
``` | ||
```js | ||
const listener = emitter.on('test', (a,b,c) => { | ||
@@ -47,3 +56,3 @@ console.log('>>', a, b, c); | ||
Add listener on test event with priority | ||
``` | ||
```js | ||
emitter.on('test', (a,b,c) => { | ||
@@ -60,3 +69,3 @@ console.log('second'); | ||
Returns promise that resolves when all listeners executed. | ||
``` | ||
```js | ||
emitter.emit('test', 'a', 'b', 'c'); | ||
@@ -66,3 +75,3 @@ ``` | ||
Use middleware on test event | ||
``` | ||
```js | ||
emitter.use('test', async (params) => { | ||
@@ -87,3 +96,3 @@ const [a,b,c] = params; | ||
Use middleware on test event with specific priority | ||
``` | ||
```js | ||
emitter.use('test', async (params) => { | ||
@@ -118,3 +127,3 @@ const [a,b,c] = params; | ||
Add middleware on test event at once | ||
``` | ||
```js | ||
emitter.use( | ||
@@ -150,3 +159,3 @@ 'test', | ||
Async listeners | ||
``` | ||
```js | ||
const delay = (ms) => new Promise((resolve, reject) => { | ||
@@ -174,3 +183,4 @@ setTimeout(() => { resolve(); }, ms); | ||
1. TODO(s) in listener_handler module | ||
2. Improve README.md | ||
3. Improve test coverage | ||
4. Improve README.md | ||
@@ -177,0 +187,0 @@ ## License |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
0
195
13002
18
4
27
1
- Removedbabel-runtime@^6.26.0
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedregenerator-runtime@0.11.1(transitive)