tiny-emitter
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -45,3 +45,3 @@ function Emitter () { | ||
if (!evts) this; | ||
if (!evts) return this; | ||
@@ -48,0 +48,0 @@ if (!callback) { |
{ | ||
"name": "tiny-emitter", | ||
"version": "0.1.3", | ||
"description": "A tiny (less than 500 bytes) event emitter library", | ||
"version": "0.1.4", | ||
"description": "A tiny (less than 1k) event emitter library", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node test/index.js | node_modules/.bin/tspec" | ||
"test": "node test/index.js | node_modules/.bin/tspec", | ||
"bundle": "node_modules/.bin/browserify index.js > dist/tinyemitter.js -s TinyEmitter && echo 'Bundled'", | ||
"minify": "node_modules/.bin/uglifyjs dist/tinyemitter.js -o dist/tinyemitter.min.js && echo 'Minified'", | ||
"build": "npm test && npm run bundle && npm run minify" | ||
}, | ||
@@ -28,4 +31,6 @@ "repository": { | ||
"tape": "~2.3.2", | ||
"tap-spec": "~0.1.1" | ||
"tap-spec": "~0.1.1", | ||
"browserify": "~3.18.0", | ||
"uglify-js": "~2.4.8" | ||
} | ||
} |
# tiny-emitter | ||
A tiny (less than 500 bytes) event emitter library. Works with [Browserify](http://browserify.org). | ||
A tiny (less than 1k) event emitter library. Works in the browser, in Node, and with [Browserify](http://browserify.org). | ||
## Install | ||
Node and Browserify | ||
``` | ||
@@ -11,4 +13,16 @@ npm install tiny-emitter --save | ||
Browser | ||
``` | ||
bower install tiny-emitter --save | ||
``` | ||
```html | ||
<script src="bower_compontents/tiny-emitter/dist/tinyemitter.min.js"></script> | ||
``` | ||
## Usage | ||
Node and Browserify | ||
```js | ||
@@ -24,3 +38,12 @@ var Emitter = require('tiny-emitter'); | ||
``` | ||
Browser | ||
```js | ||
var emitter = new TinyEmitter(); | ||
emitter.on('some-event', someCallback); | ||
emitter.emit('some-event'); | ||
``` | ||
## Instance Methods | ||
@@ -57,8 +80,17 @@ | ||
* `arguments...` - any number of arguments to pass to the event subscribers | ||
## Test and Build | ||
## Run Tests | ||
Build (Tests, Browserifies, and minifies) | ||
``` | ||
npm install | ||
npm run build | ||
``` | ||
Test | ||
``` | ||
npm install | ||
npm test | ||
``` |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
10836
8
237
93
4
3
4