first commit
This commit is contained in:
22
build/node_modules/sparkles/LICENSE
generated
vendored
Normal file
22
build/node_modules/sparkles/LICENSE
generated
vendored
Normal file
@@ -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.
|
||||
|
||||
41
build/node_modules/sparkles/README.md
generated
vendored
Normal file
41
build/node_modules/sparkles/README.md
generated
vendored
Normal file
@@ -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
|
||||
45
build/node_modules/sparkles/index.js
generated
vendored
Normal file
45
build/node_modules/sparkles/index.js
generated
vendored
Normal file
@@ -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;
|
||||
76
build/node_modules/sparkles/package.json
generated
vendored
Normal file
76
build/node_modules/sparkles/package.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"sparkles@1.0.0",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "sparkles@1.0.0",
|
||||
"_id": "sparkles@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=",
|
||||
"_location": "/sparkles",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "sparkles@1.0.0",
|
||||
"name": "sparkles",
|
||||
"escapedName": "sparkles",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/glogg",
|
||||
"/has-gulplog"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"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"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/phated/sparkles#readme",
|
||||
"keywords": [
|
||||
"ee",
|
||||
"emitter",
|
||||
"events",
|
||||
"global",
|
||||
"namespaced"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "sparkles",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/phated/sparkles.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -cvL --ignore store@sparkles"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
Reference in New Issue
Block a user