diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/event-emitter | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/event-emitter')
22 files changed, 0 insertions, 1074 deletions
diff --git a/node_modules/event-emitter/.lint b/node_modules/event-emitter/.lint deleted file mode 100644 index f76e528ef..000000000 --- a/node_modules/event-emitter/.lint +++ /dev/null @@ -1,15 +0,0 @@ -@root - -module -es5 - -indent 2 -maxlen 80 -tabs - -ass -plusplus -nomen - -./benchmark -predef+ console diff --git a/node_modules/event-emitter/.npmignore b/node_modules/event-emitter/.npmignore deleted file mode 100644 index 68ebfddd2..000000000 --- a/node_modules/event-emitter/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -/.lintcache -/node_modules diff --git a/node_modules/event-emitter/.testignore b/node_modules/event-emitter/.testignore deleted file mode 100644 index f9c8c381d..000000000 --- a/node_modules/event-emitter/.testignore +++ /dev/null @@ -1 +0,0 @@ -/benchmark diff --git a/node_modules/event-emitter/.travis.yml b/node_modules/event-emitter/.travis.yml deleted file mode 100644 index 5f29034c6..000000000 --- a/node_modules/event-emitter/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/ -language: node_js -node_js: - - 0.12 - - 4 - - 6 - - 7 - -before_install: - - mkdir node_modules; ln -s ../ node_modules/event-emitter - -notifications: - email: - - medikoo+event-emitter@medikoo.com - -script: "npm test && npm run lint" diff --git a/node_modules/event-emitter/CHANGES b/node_modules/event-emitter/CHANGES deleted file mode 100644 index 3ac46ce83..000000000 --- a/node_modules/event-emitter/CHANGES +++ /dev/null @@ -1,73 +0,0 @@ -v0.3.5 -- 2017.03.15 -* Improve documentation -* Update dependencies - -v0.3.4 -- 2015.10.02 -* Add `emitError` extension - -v0.3.3 -- 2015.01.30 -* Fix reference to module in benchmarks - -v0.3.2 -- 2015.01.20 -* Improve documentation -* Configure lint scripts -* Fix spelling of LICENSE - -v0.3.1 -- 2014.04.25 -* Fix redefinition of emit method in `pipe` -* Allow custom emit method name in `pipe` - -v0.3.0 -- 2014.04.24 -* Move out from lib folder -* Do not expose all utilities on main module -* Support objects which do not inherit from Object.prototype -* Improve arguments validation -* Improve internals -* Remove Makefile -* Improve documentation - -v0.2.2 -- 2013.06.05 -* `unify` functionality - -v0.2.1 -- 2012.09.21 -* hasListeners module -* Simplified internal id (improves performance a little), now it starts with - underscore (hint it's private). Abstracted it to external module to have it - one place -* Documentation cleanup - -v0.2.0 -- 2012.09.19 -* Trashed poor implementation of v0.1 and came up with something solid - -Changes: -* Improved performance -* Fixed bugs event-emitter is now cross-prototype safe and not affected by - unexpected methods attached to Object.prototype -* Removed support for optional "emitter" argument in `emit` method, it was - cumbersome to use, and should be solved just with event objects - -v0.1.5 -- 2012.08.06 -* (maintanance) Do not use descriptors for internal objects, it exposes V8 bugs - (only Node v0.6 branch) - -v0.1.4 -- 2012.06.13 -* Fix detachment of listeners added with 'once' - -v0.1.3 -- 2012.05.28 -* Updated es5-ext to latest version (v0.8) -* Cleared package.json so it's in npm friendly format - -v0.1.2 -- 2012.01.22 -* Support for emitter argument in emit function, this allows some listeners not - to be notified about event -* allOff - removes all listeners from object -* All methods returns self object -* Internal fixes -* Travis CI integration - -v0.1.1 -- 2011.08.08 -* Added TAD test suite to devDependencies, configured test commands. - Tests can be run with 'make test' or 'npm test' - -v0.1.0 -- 2011.08.08 -Initial version diff --git a/node_modules/event-emitter/LICENSE b/node_modules/event-emitter/LICENSE deleted file mode 100644 index ccb76f6e9..000000000 --- a/node_modules/event-emitter/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2012-2015 Mariusz Nowak (www.medikoo.com) - -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/event-emitter/README.md b/node_modules/event-emitter/README.md deleted file mode 100644 index 049905429..000000000 --- a/node_modules/event-emitter/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# event-emitter -## Environment agnostic event emitter - -### Installation - - $ npm install event-emitter - -To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/) - -### Usage - -```javascript -var ee = require('event-emitter'); - -var MyClass = function () { /* .. */ }; -ee(MyClass.prototype); // All instances of MyClass will expose event-emitter interface - -var emitter = new MyClass(), listener; - -emitter.on('test', listener = function (args) { - // … react to 'test' event -}); - -emitter.once('test', function (args) { - // … react to first 'test' event (invoked only once!) -}); - -emitter.emit('test', arg1, arg2/*…args*/); // Two above listeners invoked -emitter.emit('test', arg1, arg2/*…args*/); // Only first listener invoked - -emitter.off('test', listener); // Removed first listener -emitter.emit('test', arg1, arg2/*…args*/); // No listeners invoked -``` -### Additional utilities - -#### allOff(obj) _(event-emitter/all-off)_ - -Removes all listeners from given event emitter object - -#### hasListeners(obj[, name]) _(event-emitter/has-listeners)_ - -Whether object has some listeners attached to the object. -When `name` is provided, it checks listeners for specific event name - -```javascript -var emitter = ee(); -var hasListeners = require('event-emitter/has-listeners'); -var listener = function () {}; - -hasListeners(emitter); // false - -emitter.on('foo', listener); -hasListeners(emitter); // true -hasListeners(emitter, 'foo'); // true -hasListeners(emitter, 'bar'); // false - -emitter.off('foo', listener); -hasListeners(emitter, 'foo'); // false -``` - -#### pipe(source, target[, emitMethodName]) _(event-emitter/pipe)_ - -Pipes all events from _source_ emitter onto _target_ emitter (all events from _source_ emitter will be emitted also on _target_ emitter, but not other way). -Returns _pipe_ object which exposes `pipe.close` function. Invoke it to close configured _pipe_. -It works internally by redefinition of `emit` method, if in your interface this method is referenced differently, provide its name (or symbol) with third argument. - -#### unify(emitter1, emitter2) _(event-emitter/unify)_ - -Unifies event handling for two objects. Events emitted on _emitter1_ would be also emitted on _emitter2_, and other way back. -Non reversible. - -```javascript -var eeUnify = require('event-emitter/unify'); - -var emitter1 = ee(), listener1, listener3; -var emitter2 = ee(), listener2, listener4; - -emitter1.on('test', listener1 = function () { }); -emitter2.on('test', listener2 = function () { }); - -emitter1.emit('test'); // Invoked listener1 -emitter2.emit('test'); // Invoked listener2 - -var unify = eeUnify(emitter1, emitter2); - -emitter1.emit('test'); // Invoked listener1 and listener2 -emitter2.emit('test'); // Invoked listener1 and listener2 - -emitter1.on('test', listener3 = function () { }); -emitter2.on('test', listener4 = function () { }); - -emitter1.emit('test'); // Invoked listener1, listener2, listener3 and listener4 -emitter2.emit('test'); // Invoked listener1, listener2, listener3 and listener4 -``` - -### Tests [](https://travis-ci.org/medikoo/event-emitter) - - $ npm test diff --git a/node_modules/event-emitter/all-off.js b/node_modules/event-emitter/all-off.js deleted file mode 100644 index 829be65c2..000000000 --- a/node_modules/event-emitter/all-off.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -var value = require('es5-ext/object/valid-object') - - , hasOwnProperty = Object.prototype.hasOwnProperty; - -module.exports = function (emitter/*, type*/) { - var type = arguments[1], data; - - value(emitter); - - if (type !== undefined) { - data = hasOwnProperty.call(emitter, '__ee__') && emitter.__ee__; - if (!data) return; - if (data[type]) delete data[type]; - return; - } - if (hasOwnProperty.call(emitter, '__ee__')) delete emitter.__ee__; -}; diff --git a/node_modules/event-emitter/benchmark/many-on.js b/node_modules/event-emitter/benchmark/many-on.js deleted file mode 100644 index e09bfde84..000000000 --- a/node_modules/event-emitter/benchmark/many-on.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; - -// Benchmark comparing performance of event emit for many listeners -// To run it, do following in memoizee package path: -// -// $ npm install eventemitter2 signals -// $ node benchmark/many-on.js - -var forEach = require('es5-ext/object/for-each') - , pad = require('es5-ext/string/#/pad') - - , now = Date.now - - , time, count = 1000000, i, data = {} - , ee, native, ee2, signals, a = {}, b = {}; - -ee = (function () { - var ee = require('../')(); - ee.on('test', function () { return arguments; }); - ee.on('test', function () { return arguments; }); - return ee.on('test', function () { return arguments; }); -}()); - -native = (function () { - var ee = require('events'); - ee = new ee.EventEmitter(); - ee.on('test', function () { return arguments; }); - ee.on('test', function () { return arguments; }); - return ee.on('test', function () { return arguments; }); -}()); - -ee2 = (function () { - var ee = require('eventemitter2'); - ee = new ee.EventEmitter2(); - ee.on('test', function () { return arguments; }); - ee.on('test', function () { return arguments; }); - return ee.on('test', function () { return arguments; }); -}()); - -signals = (function () { - var Signal = require('signals') - , ee = { test: new Signal() }; - ee.test.add(function () { return arguments; }); - ee.test.add(function () { return arguments; }); - ee.test.add(function () { return arguments; }); - return ee; -}()); - -console.log("Emit for 3 listeners", "x" + count + ":\n"); - -i = count; -time = now(); -while (i--) { - ee.emit('test', a, b); -} -data["event-emitter (this implementation)"] = now() - time; - -i = count; -time = now(); -while (i--) { - native.emit('test', a, b); -} -data["EventEmitter (Node.js native)"] = now() - time; - -i = count; -time = now(); -while (i--) { - ee2.emit('test', a, b); -} -data.EventEmitter2 = now() - time; - -i = count; -time = now(); -while (i--) { - signals.test.dispatch(a, b); -} -data.Signals = now() - time; - -forEach(data, function (value, name, obj, index) { - console.log(index + 1 + ":", pad.call(value, " ", 5), name); -}, null, function (a, b) { - return this[a] - this[b]; -}); diff --git a/node_modules/event-emitter/benchmark/single-on.js b/node_modules/event-emitter/benchmark/single-on.js deleted file mode 100644 index 99decbdae..000000000 --- a/node_modules/event-emitter/benchmark/single-on.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; - -// Benchmark comparing performance of event emit for single listener -// To run it, do following in memoizee package path: -// -// $ npm install eventemitter2 signals -// $ node benchmark/single-on.js - -var forEach = require('es5-ext/object/for-each') - , pad = require('es5-ext/string/#/pad') - - , now = Date.now - - , time, count = 1000000, i, data = {} - , ee, native, ee2, signals, a = {}, b = {}; - -ee = (function () { - var ee = require('../'); - return ee().on('test', function () { return arguments; }); -}()); - -native = (function () { - var ee = require('events'); - return (new ee.EventEmitter()).on('test', function () { return arguments; }); -}()); - -ee2 = (function () { - var ee = require('eventemitter2'); - return (new ee.EventEmitter2()).on('test', function () { return arguments; }); -}()); - -signals = (function () { - var Signal = require('signals') - , ee = { test: new Signal() }; - ee.test.add(function () { return arguments; }); - return ee; -}()); - -console.log("Emit for single listener", "x" + count + ":\n"); - -i = count; -time = now(); -while (i--) { - ee.emit('test', a, b); -} -data["event-emitter (this implementation)"] = now() - time; - -i = count; -time = now(); -while (i--) { - native.emit('test', a, b); -} -data["EventEmitter (Node.js native)"] = now() - time; - -i = count; -time = now(); -while (i--) { - ee2.emit('test', a, b); -} -data.EventEmitter2 = now() - time; - -i = count; -time = now(); -while (i--) { - signals.test.dispatch(a, b); -} -data.Signals = now() - time; - -forEach(data, function (value, name, obj, index) { - console.log(index + 1 + ":", pad.call(value, " ", 5), name); -}, null, function (a, b) { - return this[a] - this[b]; -}); diff --git a/node_modules/event-emitter/emit-error.js b/node_modules/event-emitter/emit-error.js deleted file mode 100644 index 769b4c53e..000000000 --- a/node_modules/event-emitter/emit-error.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var ensureError = require('es5-ext/error/valid-error') - , ensureObject = require('es5-ext/object/valid-object') - - , hasOwnProperty = Object.prototype.hasOwnProperty; - -module.exports = function (err) { - (ensureObject(this) && ensureError(err)); - if (!hasOwnProperty.call(ensureObject(this), '__ee__')) throw err; - if (!this.__ee__.error) throw err; - this.emit('error', err); -}; diff --git a/node_modules/event-emitter/has-listeners.js b/node_modules/event-emitter/has-listeners.js deleted file mode 100644 index 8744522e2..000000000 --- a/node_modules/event-emitter/has-listeners.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var isEmpty = require('es5-ext/object/is-empty') - , value = require('es5-ext/object/valid-value') - - , hasOwnProperty = Object.prototype.hasOwnProperty; - -module.exports = function (obj/*, type*/) { - var type; - value(obj); - type = arguments[1]; - if (arguments.length > 1) { - return hasOwnProperty.call(obj, '__ee__') && Boolean(obj.__ee__[type]); - } - return obj.hasOwnProperty('__ee__') && !isEmpty(obj.__ee__); -}; diff --git a/node_modules/event-emitter/index.js b/node_modules/event-emitter/index.js deleted file mode 100644 index c36d3e49a..000000000 --- a/node_modules/event-emitter/index.js +++ /dev/null @@ -1,132 +0,0 @@ -'use strict'; - -var d = require('d') - , callable = require('es5-ext/object/valid-callable') - - , apply = Function.prototype.apply, call = Function.prototype.call - , create = Object.create, defineProperty = Object.defineProperty - , defineProperties = Object.defineProperties - , hasOwnProperty = Object.prototype.hasOwnProperty - , descriptor = { configurable: true, enumerable: false, writable: true } - - , on, once, off, emit, methods, descriptors, base; - -on = function (type, listener) { - var data; - - callable(listener); - - if (!hasOwnProperty.call(this, '__ee__')) { - data = descriptor.value = create(null); - defineProperty(this, '__ee__', descriptor); - descriptor.value = null; - } else { - data = this.__ee__; - } - if (!data[type]) data[type] = listener; - else if (typeof data[type] === 'object') data[type].push(listener); - else data[type] = [data[type], listener]; - - return this; -}; - -once = function (type, listener) { - var once, self; - - callable(listener); - self = this; - on.call(this, type, once = function () { - off.call(self, type, once); - apply.call(listener, this, arguments); - }); - - once.__eeOnceListener__ = listener; - return this; -}; - -off = function (type, listener) { - var data, listeners, candidate, i; - - callable(listener); - - if (!hasOwnProperty.call(this, '__ee__')) return this; - data = this.__ee__; - if (!data[type]) return this; - listeners = data[type]; - - if (typeof listeners === 'object') { - for (i = 0; (candidate = listeners[i]); ++i) { - if ((candidate === listener) || - (candidate.__eeOnceListener__ === listener)) { - if (listeners.length === 2) data[type] = listeners[i ? 0 : 1]; - else listeners.splice(i, 1); - } - } - } else { - if ((listeners === listener) || - (listeners.__eeOnceListener__ === listener)) { - delete data[type]; - } - } - - return this; -}; - -emit = function (type) { - var i, l, listener, listeners, args; - - if (!hasOwnProperty.call(this, '__ee__')) return; - listeners = this.__ee__[type]; - if (!listeners) return; - - if (typeof listeners === 'object') { - l = arguments.length; - args = new Array(l - 1); - for (i = 1; i < l; ++i) args[i - 1] = arguments[i]; - - listeners = listeners.slice(); - for (i = 0; (listener = listeners[i]); ++i) { - apply.call(listener, this, args); - } - } else { - switch (arguments.length) { - case 1: - call.call(listeners, this); - break; - case 2: - call.call(listeners, this, arguments[1]); - break; - case 3: - call.call(listeners, this, arguments[1], arguments[2]); - break; - default: - l = arguments.length; - args = new Array(l - 1); - for (i = 1; i < l; ++i) { - args[i - 1] = arguments[i]; - } - apply.call(listeners, this, args); - } - } -}; - -methods = { - on: on, - once: once, - off: off, - emit: emit -}; - -descriptors = { - on: d(on), - once: d(once), - off: d(off), - emit: d(emit) -}; - -base = defineProperties({}, descriptors); - -module.exports = exports = function (o) { - return (o == null) ? create(base) : defineProperties(Object(o), descriptors); -}; -exports.methods = methods; diff --git a/node_modules/event-emitter/package.json b/node_modules/event-emitter/package.json deleted file mode 100644 index 8784036e9..000000000 --- a/node_modules/event-emitter/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "event-emitter", - "version": "0.3.5", - "description": "Environment agnostic event emitter", - "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", - "keywords": [ - "event", - "events", - "trigger", - "observer", - "listener", - "emitter", - "pubsub" - ], - "repository": { - "type": "git", - "url": "git://github.com/medikoo/event-emitter.git" - }, - "dependencies": { - "es5-ext": "~0.10.14", - "d": "1" - }, - "devDependencies": { - "tad": "~0.2.7", - "xlint": "~0.2.2", - "xlint-jslint-medikoo": "~0.1.4" - }, - "scripts": { - "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream", - "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch", - "test": "node ./node_modules/tad/bin/tad" - }, - "license": "MIT" -} diff --git a/node_modules/event-emitter/pipe.js b/node_modules/event-emitter/pipe.js deleted file mode 100644 index 0088efefa..000000000 --- a/node_modules/event-emitter/pipe.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var aFrom = require('es5-ext/array/from') - , remove = require('es5-ext/array/#/remove') - , value = require('es5-ext/object/valid-object') - , d = require('d') - , emit = require('./').methods.emit - - , defineProperty = Object.defineProperty - , hasOwnProperty = Object.prototype.hasOwnProperty - , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - -module.exports = function (e1, e2/*, name*/) { - var pipes, pipe, desc, name; - - (value(e1) && value(e2)); - name = arguments[2]; - if (name === undefined) name = 'emit'; - - pipe = { - close: function () { remove.call(pipes, e2); } - }; - if (hasOwnProperty.call(e1, '__eePipes__')) { - (pipes = e1.__eePipes__).push(e2); - return pipe; - } - defineProperty(e1, '__eePipes__', d('c', pipes = [e2])); - desc = getOwnPropertyDescriptor(e1, name); - if (!desc) { - desc = d('c', undefined); - } else { - delete desc.get; - delete desc.set; - } - desc.value = function () { - var i, emitter, data = aFrom(pipes); - emit.apply(this, arguments); - for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments); - }; - defineProperty(e1, name, desc); - return pipe; -}; diff --git a/node_modules/event-emitter/test/all-off.js b/node_modules/event-emitter/test/all-off.js deleted file mode 100644 index 8aa872e9c..000000000 --- a/node_modules/event-emitter/test/all-off.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t, a) { - var x, count, count2; - - x = ee(); - count = 0; - count2 = 0; - x.on('foo', function () { - ++count; - }); - x.on('foo', function () { - ++count; - }); - x.on('bar', function () { - ++count2; - }); - x.on('bar', function () { - ++count2; - }); - t(x, 'foo'); - x.emit('foo'); - x.emit('bar'); - a(count, 0, "All off: type"); - a(count2, 2, "All off: ohter type"); - - count = 0; - count2 = 0; - x.on('foo', function () { - ++count; - }); - x.on('foo', function () { - ++count; - }); - x.on('bar', function () { - ++count2; - }); - x.on('bar', function () { - ++count2; - }); - t(x); - x.emit('foo'); - x.emit('bar'); - a(count, 0, "All off: type"); - a(count2, 0, "All off: other type"); -}; diff --git a/node_modules/event-emitter/test/emit-error.js b/node_modules/event-emitter/test/emit-error.js deleted file mode 100644 index edac350af..000000000 --- a/node_modules/event-emitter/test/emit-error.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -var customError = require('es5-ext/error/custom') - , ee = require('../'); - -module.exports = function (t, a) { - var x, error = customError('Some error', 'ERROR_TEST'), emitted; - - x = ee(); - a.throws(function () { t.call(x, error); }, 'ERROR_TEST'); - x.on('error', function (err) { emitted = err; }); - t.call(x, error); - a(emitted, error); -}; diff --git a/node_modules/event-emitter/test/has-listeners.js b/node_modules/event-emitter/test/has-listeners.js deleted file mode 100644 index 875b048a4..000000000 --- a/node_modules/event-emitter/test/has-listeners.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t) { - var x, y; - return { - Any: function (a) { - a(t(true), false, "Primitive"); - a(t({ events: [] }), false, "Other object"); - a(t(x = ee()), false, "Emitter: empty"); - - x.on('test', y = function () {}); - a(t(x), true, "Emitter: full"); - x.off('test', y); - a(t(x), false, "Emitter: empty but touched"); - x.once('test', y = function () {}); - a(t(x), true, "Emitter: full: Once"); - x.off('test', y); - a(t(x), false, "Emitter: empty but touched by once"); - }, - Specific: function (a) { - a(t(true, 'test'), false, "Primitive"); - a(t({ events: [] }, 'test'), false, "Other object"); - a(t(x = ee(), 'test'), false, "Emitter: empty"); - - x.on('test', y = function () {}); - a(t(x, 'test'), true, "Emitter: full"); - a(t(x, 'foo'), false, "Emitter: full, other event"); - x.off('test', y); - a(t(x, 'test'), false, "Emitter: empty but touched"); - a(t(x, 'foo'), false, "Emitter: empty but touched, other event"); - - x.once('test', y = function () {}); - a(t(x, 'test'), true, "Emitter: full: Once"); - a(t(x, 'foo'), false, "Emitter: full: Once, other event"); - x.off('test', y); - a(t(x, 'test'), false, "Emitter: empty but touched by once"); - a(t(x, 'foo'), false, "Emitter: empty but touched by once, other event"); - } - }; -}; diff --git a/node_modules/event-emitter/test/index.js b/node_modules/event-emitter/test/index.js deleted file mode 100644 index c7c3f24c4..000000000 --- a/node_modules/event-emitter/test/index.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict'; - -module.exports = function (t, a) { - var x = t(), y, count, count2, count3, count4, test, listener1, listener2; - - x.emit('none'); - - test = "Once: "; - count = 0; - x.once('foo', function (a1, a2, a3) { - a(this, x, test + "Context"); - a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); - ++count; - }); - - x.emit('foobar'); - a(count, 0, test + "Not invoked on other event"); - x.emit('foo', 'foo', x, 15); - a(count, 1, test + "Emitted"); - x.emit('foo'); - a(count, 1, test + "Emitted once"); - - test = "On & Once: "; - count = 0; - x.on('foo', listener1 = function (a1, a2, a3) { - a(this, x, test + "Context"); - a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); - ++count; - }); - count2 = 0; - x.once('foo', listener2 = function (a1, a2, a3) { - a(this, x, test + "Context"); - a.deep([a1, a2, a3], ['foo', x, 15], test + "Arguments"); - ++count2; - }); - - x.emit('foobar'); - a(count, 0, test + "Not invoked on other event"); - x.emit('foo', 'foo', x, 15); - a(count, 1, test + "Emitted"); - x.emit('foo', 'foo', x, 15); - a(count, 2, test + "Emitted twice"); - a(count2, 1, test + "Emitted once"); - x.off('foo', listener1); - x.emit('foo'); - a(count, 2, test + "Not emitter after off"); - - count = 0; - x.once('foo', listener1 = function () { ++count; }); - - x.off('foo', listener1); - x.emit('foo'); - a(count, 0, "Once Off: Not emitted"); - - count = 0; - x.on('foo', listener2 = function () {}); - x.once('foo', listener1 = function () { ++count; }); - - x.off('foo', listener1); - x.emit('foo'); - a(count, 0, "Once Off (multi): Not emitted"); - x.off('foo', listener2); - - test = "Prototype Share: "; - - y = Object.create(x); - - count = 0; - count2 = 0; - count3 = 0; - count4 = 0; - x.on('foo', function () { - ++count; - }); - y.on('foo', function () { - ++count2; - }); - x.once('foo', function () { - ++count3; - }); - y.once('foo', function () { - ++count4; - }); - x.emit('foo'); - a(count, 1, test + "x on count"); - a(count2, 0, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 0, test + "y once count"); - - y.emit('foo'); - a(count, 1, test + "x on count"); - a(count2, 1, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 1, test + "y once count"); - - x.emit('foo'); - a(count, 2, test + "x on count"); - a(count2, 1, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 1, test + "y once count"); - - y.emit('foo'); - a(count, 2, test + "x on count"); - a(count2, 2, test + "y on count"); - a(count3, 1, test + "x once count"); - a(count4, 1, test + "y once count"); -}; diff --git a/node_modules/event-emitter/test/pipe.js b/node_modules/event-emitter/test/pipe.js deleted file mode 100644 index 9d15d6dae..000000000 --- a/node_modules/event-emitter/test/pipe.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t, a) { - var x = {}, y = {}, z = {}, count, count2, count3, pipe; - - ee(x); - x = Object.create(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - x.on('foo', function () { - ++count; - }); - y.on('foo', function () { - ++count2; - }); - z.on('foo', function () { - ++count3; - }); - - x.emit('foo'); - a(count, 1, "Pre pipe, x"); - a(count2, 0, "Pre pipe, y"); - a(count3, 0, "Pre pipe, z"); - - pipe = t(x, y); - x.emit('foo'); - a(count, 2, "Post pipe, x"); - a(count2, 1, "Post pipe, y"); - a(count3, 0, "Post pipe, z"); - - y.emit('foo'); - a(count, 2, "Post pipe, on y, x"); - a(count2, 2, "Post pipe, on y, y"); - a(count3, 0, "Post pipe, on y, z"); - - t(x, z); - x.emit('foo'); - a(count, 3, "Post pipe z, x"); - a(count2, 3, "Post pipe z, y"); - a(count3, 1, "Post pipe z, z"); - - pipe.close(); - x.emit('foo'); - a(count, 4, "Close pipe y, x"); - a(count2, 3, "Close pipe y, y"); - a(count3, 2, "Close pipe y, z"); -}; diff --git a/node_modules/event-emitter/test/unify.js b/node_modules/event-emitter/test/unify.js deleted file mode 100644 index 69295e065..000000000 --- a/node_modules/event-emitter/test/unify.js +++ /dev/null @@ -1,123 +0,0 @@ -'use strict'; - -var ee = require('../'); - -module.exports = function (t) { - - return { - "": function (a) { - var x = {}, y = {}, z = {}, count, count2, count3; - - ee(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - x.on('foo', function () { ++count; }); - y.on('foo', function () { ++count2; }); - z.on('foo', function () { ++count3; }); - - x.emit('foo'); - a(count, 1, "Pre unify, x"); - a(count2, 0, "Pre unify, y"); - a(count3, 0, "Pre unify, z"); - - t(x, y); - a(x.__ee__, y.__ee__, "Post unify y"); - x.emit('foo'); - a(count, 2, "Post unify, x"); - a(count2, 1, "Post unify, y"); - a(count3, 0, "Post unify, z"); - - y.emit('foo'); - a(count, 3, "Post unify, on y, x"); - a(count2, 2, "Post unify, on y, y"); - a(count3, 0, "Post unify, on y, z"); - - t(x, z); - a(x.__ee__, x.__ee__, "Post unify z"); - x.emit('foo'); - a(count, 4, "Post unify z, x"); - a(count2, 3, "Post unify z, y"); - a(count3, 1, "Post unify z, z"); - }, - "On empty": function (a) { - var x = {}, y = {}, z = {}, count, count2, count3; - - ee(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - y.on('foo', function () { ++count2; }); - x.emit('foo'); - a(count, 0, "Pre unify, x"); - a(count2, 0, "Pre unify, y"); - a(count3, 0, "Pre unify, z"); - - t(x, y); - a(x.__ee__, y.__ee__, "Post unify y"); - x.on('foo', function () { ++count; }); - x.emit('foo'); - a(count, 1, "Post unify, x"); - a(count2, 1, "Post unify, y"); - a(count3, 0, "Post unify, z"); - - y.emit('foo'); - a(count, 2, "Post unify, on y, x"); - a(count2, 2, "Post unify, on y, y"); - a(count3, 0, "Post unify, on y, z"); - - t(x, z); - a(x.__ee__, z.__ee__, "Post unify z"); - z.on('foo', function () { ++count3; }); - x.emit('foo'); - a(count, 3, "Post unify z, x"); - a(count2, 3, "Post unify z, y"); - a(count3, 1, "Post unify z, z"); - }, - Many: function (a) { - var x = {}, y = {}, z = {}, count, count2, count3; - - ee(x); - ee(y); - ee(z); - - count = 0; - count2 = 0; - count3 = 0; - x.on('foo', function () { ++count; }); - y.on('foo', function () { ++count2; }); - y.on('foo', function () { ++count2; }); - z.on('foo', function () { ++count3; }); - - x.emit('foo'); - a(count, 1, "Pre unify, x"); - a(count2, 0, "Pre unify, y"); - a(count3, 0, "Pre unify, z"); - - t(x, y); - a(x.__ee__, y.__ee__, "Post unify y"); - x.emit('foo'); - a(count, 2, "Post unify, x"); - a(count2, 2, "Post unify, y"); - a(count3, 0, "Post unify, z"); - - y.emit('foo'); - a(count, 3, "Post unify, on y, x"); - a(count2, 4, "Post unify, on y, y"); - a(count3, 0, "Post unify, on y, z"); - - t(x, z); - a(x.__ee__, x.__ee__, "Post unify z"); - x.emit('foo'); - a(count, 4, "Post unify z, x"); - a(count2, 6, "Post unify z, y"); - a(count3, 1, "Post unify z, z"); - } - }; -}; diff --git a/node_modules/event-emitter/unify.js b/node_modules/event-emitter/unify.js deleted file mode 100644 index c6a858a0b..000000000 --- a/node_modules/event-emitter/unify.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -var forEach = require('es5-ext/object/for-each') - , validValue = require('es5-ext/object/valid-object') - - , push = Array.prototype.apply, defineProperty = Object.defineProperty - , create = Object.create, hasOwnProperty = Object.prototype.hasOwnProperty - , d = { configurable: true, enumerable: false, writable: true }; - -module.exports = function (e1, e2) { - var data; - (validValue(e1) && validValue(e2)); - if (!hasOwnProperty.call(e1, '__ee__')) { - if (!hasOwnProperty.call(e2, '__ee__')) { - d.value = create(null); - defineProperty(e1, '__ee__', d); - defineProperty(e2, '__ee__', d); - d.value = null; - return; - } - d.value = e2.__ee__; - defineProperty(e1, '__ee__', d); - d.value = null; - return; - } - data = d.value = e1.__ee__; - if (!hasOwnProperty.call(e2, '__ee__')) { - defineProperty(e2, '__ee__', d); - d.value = null; - return; - } - if (data === e2.__ee__) return; - forEach(e2.__ee__, function (listener, name) { - if (!data[name]) { - data[name] = listener; - return; - } - if (typeof data[name] === 'object') { - if (typeof listener === 'object') push.apply(data[name], listener); - else data[name].push(listener); - } else if (typeof listener === 'object') { - listener.unshift(data[name]); - data[name] = listener; - } else { - data[name] = [data[name], listener]; - } - }); - defineProperty(e2, '__ee__', d); - d.value = null; -}; |