+13
-2
@@ -8,4 +8,3 @@ 'use strict'; | ||
| function getEmitter(namespace){ | ||
| function getStore(){ | ||
| var store = global[sparklesNamespace]; | ||
@@ -17,2 +16,9 @@ | ||
| return store; | ||
| } | ||
| function getEmitter(namespace){ | ||
| var store = getStore(); | ||
| namespace = namespace || defaultNamespace; | ||
@@ -32,6 +38,11 @@ | ||
| return ee; | ||
| } | ||
| function exists(namespace){ | ||
| var store = getStore(); | ||
| return !!(store[namespace]); | ||
| } | ||
| module.exports = getEmitter; | ||
| module.exports.exists = exists; |
+12
-11
| { | ||
| "name": "sparkles", | ||
| "version": "0.1.0", | ||
| "version": "1.0.0", | ||
| "description": "Namespaced global event emitter", | ||
@@ -14,23 +14,24 @@ "author": "Blaine Bublitz <blaine@iceddev.com> (http://iceddev.com/)", | ||
| "files": [ | ||
| "index.js", | ||
| "LICENSE" | ||
| "LICENSE", | ||
| "index.js" | ||
| ], | ||
| "scripts": { | ||
| "test": "lab -cv --ignore store@sparkles", | ||
| "lint": "jshint test index.js --reporter node_modules/jshint-stylish/stylish.js --exclude node_modules" | ||
| "test": "lab -cvL --ignore store@sparkles" | ||
| }, | ||
| "dependencies": {}, | ||
| "devDependencies": { | ||
| "code": "^1.2.1", | ||
| "jshint": "^2.5.10", | ||
| "jshint-stylish": "^1.0.0", | ||
| "lab": "^5.1.0" | ||
| "@phated/eslint-config-iceddev": "^0.2.1", | ||
| "code": "^1.5.0", | ||
| "eslint": "^1.3.1", | ||
| "eslint-plugin-mocha": "^0.5.1", | ||
| "eslint-plugin-react": "^3.3.1", | ||
| "lab": "^5.16.0" | ||
| }, | ||
| "keywords": [ | ||
| "global", | ||
| "ee", | ||
| "emitter", | ||
| "events", | ||
| "emitter", | ||
| "global", | ||
| "namespaced" | ||
| ] | ||
| } |
+12
-1
@@ -24,4 +24,15 @@ sparkles | ||
| # Why the name? | ||
| ## API | ||
| ### sparkles(namespace) | ||
| Returns an EventEmitter that is shared amongst the provided namespace. If no namespace | ||
| is provided, returns a default EventEmitter. | ||
| ### sparkles.exists(namespace); | ||
| Checks whether a namespace exists and returns true or false. | ||
| ## Why the name? | ||
| This is a "global emitter"; shortened: "glitter" but it was already taken; so we got sparkles instead :smile: | ||
@@ -28,0 +39,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3581
13.65%31
40.91%1
-50%42
35.48%6
50%