diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/sparkles | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) |
add node_modules to address #4364
Diffstat (limited to 'node_modules/sparkles')
-rw-r--r-- | node_modules/sparkles/LICENSE | 22 | ||||
-rw-r--r-- | node_modules/sparkles/README.md | 41 | ||||
-rw-r--r-- | node_modules/sparkles/index.js | 45 | ||||
-rw-r--r-- | node_modules/sparkles/package.json | 104 |
4 files changed, 212 insertions, 0 deletions
diff --git a/node_modules/sparkles/LICENSE b/node_modules/sparkles/LICENSE new file mode 100644 index 000000000..2d92a2b7f --- /dev/null +++ b/node_modules/sparkles/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blaine Bublitz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/sparkles/README.md b/node_modules/sparkles/README.md new file mode 100644 index 000000000..8dfdb9cb2 --- /dev/null +++ b/node_modules/sparkles/README.md @@ -0,0 +1,41 @@ +sparkles +======== + +[](https://travis-ci.org/phated/sparkles) + +Namespaced global event emitter + +## Usage + +Sparkles exports a function that returns a singleton `EventEmitter`. +This EE can be shared across your application, whether or not node loads +multiple copies. + +```js +var sparkles = require('sparkles')(); // make sure to call the function + +sparkles.on('my-event', function(evt){ + console.log('my-event handled', evt); +}); + +sparkles.emit('my-event', { my: 'event' }); +``` + +## 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: + +## License + +MIT diff --git a/node_modules/sparkles/index.js b/node_modules/sparkles/index.js new file mode 100644 index 000000000..1183745d5 --- /dev/null +++ b/node_modules/sparkles/index.js @@ -0,0 +1,45 @@ +'use strict'; + +var EventEmitter = require('events').EventEmitter; + +var sparklesNamespace = 'store@sparkles'; +var defaultNamespace = 'default'; + +function getStore(){ + var store = global[sparklesNamespace]; + + if(!store){ + store = global[sparklesNamespace] = {}; + } + + return store; +} + +function getEmitter(namespace){ + + var store = getStore(); + + namespace = namespace || defaultNamespace; + + var ee = store[namespace]; + + if(!ee){ + ee = store[namespace] = new EventEmitter(); + ee.setMaxListeners(0); + ee.remove = function remove(){ + ee.removeAllListeners(); + delete store[namespace]; + }; + } + + return ee; +} + +function exists(namespace){ + var store = getStore(); + + return !!(store[namespace]); +} + +module.exports = getEmitter; +module.exports.exists = exists; diff --git a/node_modules/sparkles/package.json b/node_modules/sparkles/package.json new file mode 100644 index 000000000..044a68f42 --- /dev/null +++ b/node_modules/sparkles/package.json @@ -0,0 +1,104 @@ +{ + "_args": [ + [ + { + "raw": "sparkles@^1.0.0", + "scope": null, + "escapedName": "sparkles", + "name": "sparkles", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/glogg" + ] + ], + "_from": "sparkles@>=1.0.0 <2.0.0", + "_id": "sparkles@1.0.0", + "_inCache": true, + "_location": "/sparkles", + "_nodeVersion": "0.10.36", + "_npmUser": { + "name": "phated", + "email": "blaine@iceddev.com" + }, + "_npmVersion": "2.8.3", + "_phantomChildren": {}, + "_requested": { + "raw": "sparkles@^1.0.0", + "scope": null, + "escapedName": "sparkles", + "name": "sparkles", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/glogg", + "/has-gulplog" + ], + "_resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", + "_shasum": "1acbbfb592436d10bbe8f785b7cc6f82815012c3", + "_shrinkwrap": null, + "_spec": "sparkles@^1.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/glogg", + "author": { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://iceddev.com/" + }, + "bugs": { + "url": "https://github.com/phated/sparkles/issues" + }, + "contributors": [], + "dependencies": {}, + "description": "Namespaced global event emitter", + "devDependencies": { + "@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" + }, + "directories": {}, + "dist": { + "shasum": "1acbbfb592436d10bbe8f785b7cc6f82815012c3", + "tarball": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz" + }, + "engines": { + "node": ">= 0.10" + }, + "files": [ + "LICENSE", + "index.js" + ], + "gitHead": "66eed55eeac9f3ba641d4643c5ad2ed598bc6a72", + "homepage": "https://github.com/phated/sparkles#readme", + "keywords": [ + "ee", + "emitter", + "events", + "global", + "namespaced" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "name": "sparkles", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/phated/sparkles.git" + }, + "scripts": { + "test": "lab -cvL --ignore store@sparkles" + }, + "version": "1.0.0" +} |