initial commit
This commit is contained in:
15
node_modules/event-emitter/.lint
generated
vendored
Normal file
15
node_modules/event-emitter/.lint
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
@root
|
||||
|
||||
module
|
||||
es5
|
||||
|
||||
indent 2
|
||||
maxlen 80
|
||||
tabs
|
||||
|
||||
ass
|
||||
plusplus
|
||||
nomen
|
||||
|
||||
./benchmark
|
||||
predef+ console
|
||||
3
node_modules/event-emitter/.npmignore
generated
vendored
Normal file
3
node_modules/event-emitter/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.DS_Store
|
||||
/.lintcache
|
||||
/node_modules
|
||||
1
node_modules/event-emitter/.testignore
generated
vendored
Normal file
1
node_modules/event-emitter/.testignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/benchmark
|
||||
16
node_modules/event-emitter/.travis.yml
generated
vendored
Normal file
16
node_modules/event-emitter/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
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"
|
||||
73
node_modules/event-emitter/CHANGES
generated
vendored
Normal file
73
node_modules/event-emitter/CHANGES
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
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
|
||||
19
node_modules/event-emitter/LICENSE
generated
vendored
Normal file
19
node_modules/event-emitter/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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.
|
||||
98
node_modules/event-emitter/README.md
generated
vendored
Normal file
98
node_modules/event-emitter/README.md
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
# 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
|
||||
19
node_modules/event-emitter/all-off.js
generated
vendored
Normal file
19
node_modules/event-emitter/all-off.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'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__;
|
||||
};
|
||||
83
node_modules/event-emitter/benchmark/many-on.js
generated
vendored
Normal file
83
node_modules/event-emitter/benchmark/many-on.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
'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];
|
||||
});
|
||||
73
node_modules/event-emitter/benchmark/single-on.js
generated
vendored
Normal file
73
node_modules/event-emitter/benchmark/single-on.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'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];
|
||||
});
|
||||
13
node_modules/event-emitter/emit-error.js
generated
vendored
Normal file
13
node_modules/event-emitter/emit-error.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'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);
|
||||
};
|
||||
16
node_modules/event-emitter/has-listeners.js
generated
vendored
Normal file
16
node_modules/event-emitter/has-listeners.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'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__);
|
||||
};
|
||||
132
node_modules/event-emitter/index.js
generated
vendored
Normal file
132
node_modules/event-emitter/index.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
'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;
|
||||
15
node_modules/event-emitter/node_modules/d/CHANGELOG.md
generated
vendored
Normal file
15
node_modules/event-emitter/node_modules/d/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [1.0.2](https://github.com/medikoo/d/compare/v1.0.1...v1.0.2) (2024-03-01)
|
||||
|
||||
### Maintenance Improvements
|
||||
|
||||
- Upgrade `type` to v2 ([43b0eb8](https://github.com/medikoo/d/commit/43b0eb845d9efad3450e0e641ea1a827a5ba1966))
|
||||
|
||||
### [1.0.1](https://github.com/medikoo/d/compare/v0.1.1...v1.0.1) (2019-06-14)
|
||||
|
||||
## Changelog for previous versions
|
||||
|
||||
See `CHANGES` file
|
||||
17
node_modules/event-emitter/node_modules/d/CHANGES
generated
vendored
Normal file
17
node_modules/event-emitter/node_modules/d/CHANGES
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
For recent changelog see CHANGELOG.md
|
||||
|
||||
-----
|
||||
|
||||
v1.0.0 -- 2015.12.04
|
||||
- autoBind changes:
|
||||
- replace `bindTo` argument with options and `resolveContext` option
|
||||
- Add support `overwriteDefinition`
|
||||
- Introduce IE11 bug workaround in `lazy` handler
|
||||
|
||||
v0.1.1 -- 2014.04.24
|
||||
- Add `autoBind` and `lazy` utilities
|
||||
- Allow to pass other options to be merged onto created descriptor.
|
||||
Useful when used with other custom utilties
|
||||
|
||||
v0.1.0 -- 2013.06.20
|
||||
Initial (derived from es5-ext project)
|
||||
15
node_modules/event-emitter/node_modules/d/LICENSE
generated
vendored
Normal file
15
node_modules/event-emitter/node_modules/d/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2013-2024, Mariusz Nowak, @medikoo, medikoo.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
129
node_modules/event-emitter/node_modules/d/README.md
generated
vendored
Normal file
129
node_modules/event-emitter/node_modules/d/README.md
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
[![Build status][build-image]][build-url]
|
||||
[![Tests coverage][cov-image]][cov-url]
|
||||
[![npm version][npm-image]][npm-url]
|
||||
|
||||
# d
|
||||
|
||||
## Property descriptor factory
|
||||
|
||||
_Originally derived from [d](https://github.com/medikoo/d) package._
|
||||
|
||||
Defining properties with descriptors is very verbose:
|
||||
|
||||
```javascript
|
||||
var Account = function () {};
|
||||
Object.defineProperties(Account.prototype, {
|
||||
deposit: {
|
||||
value: function () { /* ... */ },
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
withdraw: {
|
||||
value: function () { /* ... */ },
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
balance: { get: function () { /* ... */ }, configurable: true, enumerable: false }
|
||||
});
|
||||
```
|
||||
|
||||
D cuts that to:
|
||||
|
||||
```javascript
|
||||
var d = require("d");
|
||||
|
||||
var Account = function () {};
|
||||
Object.defineProperties(Account.prototype, {
|
||||
deposit: d(function () { /* ... */ }),
|
||||
withdraw: d(function () { /* ... */ }),
|
||||
balance: d.gs(function () { /* ... */ })
|
||||
});
|
||||
```
|
||||
|
||||
By default, created descriptor follow characteristics of native ES5 properties, and defines values as:
|
||||
|
||||
```javascript
|
||||
{ configurable: true, enumerable: false, writable: true }
|
||||
```
|
||||
|
||||
You can overwrite it by preceding _value_ argument with instruction:
|
||||
|
||||
```javascript
|
||||
d("c", value); // { configurable: true, enumerable: false, writable: false }
|
||||
d("ce", value); // { configurable: true, enumerable: true, writable: false }
|
||||
d("e", value); // { configurable: false, enumerable: true, writable: false }
|
||||
|
||||
// Same way for get/set:
|
||||
d.gs("e", value); // { configurable: false, enumerable: true }
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
||||
$ npm install d
|
||||
|
||||
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/)
|
||||
|
||||
### Other utilities
|
||||
|
||||
#### autoBind(obj, props) _(d/auto-bind)_
|
||||
|
||||
Define methods which will be automatically bound to its instances
|
||||
|
||||
```javascript
|
||||
var d = require('d');
|
||||
var autoBind = require('d/auto-bind');
|
||||
|
||||
var Foo = function () { this._count = 0; };
|
||||
Object.defineProperties(Foo.prototype, autoBind({
|
||||
increment: d(function () { ++this._count; });
|
||||
}));
|
||||
|
||||
var foo = new Foo();
|
||||
|
||||
// Increment foo counter on each domEl click
|
||||
domEl.addEventListener('click', foo.increment, false);
|
||||
```
|
||||
|
||||
#### lazy(obj, props) _(d/lazy)_
|
||||
|
||||
Define lazy properties, which will be resolved on first access
|
||||
|
||||
```javascript
|
||||
var d = require("d");
|
||||
var lazy = require("d/lazy");
|
||||
|
||||
var Foo = function () {};
|
||||
Object.defineProperties(Foo.prototype, lazy({ items: d(function () { return []; }) }));
|
||||
|
||||
var foo = new Foo();
|
||||
foo.items.push(1, 2); // foo.items array created and defined directly on foo
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
$ npm test
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-d?utm_source=npm-d&utm_medium=referral&utm_campaign=readme">Get professional support for d with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
[build-image]: https://github.com/medikoo/d/workflows/Integrate/badge.svg
|
||||
[build-url]: https://github.com/medikoo/d/actions?query=workflow%3AIntegrate
|
||||
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/d.svg
|
||||
[cov-url]: https://codecov.io/gh/medikoo/d
|
||||
[npm-image]: https://img.shields.io/npm/v/d.svg
|
||||
[npm-url]: https://www.npmjs.com/package/d
|
||||
33
node_modules/event-emitter/node_modules/d/auto-bind.js
generated
vendored
Normal file
33
node_modules/event-emitter/node_modules/d/auto-bind.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
var isValue = require("type/value/is")
|
||||
, ensureValue = require("type/value/ensure")
|
||||
, ensurePlainFunction = require("type/plain-function/ensure")
|
||||
, copy = require("es5-ext/object/copy")
|
||||
, normalizeOptions = require("es5-ext/object/normalize-options")
|
||||
, map = require("es5-ext/object/map");
|
||||
|
||||
var bind = Function.prototype.bind
|
||||
, defineProperty = Object.defineProperty
|
||||
, hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
, define;
|
||||
|
||||
define = function (name, desc, options) {
|
||||
var value = ensureValue(desc) && ensurePlainFunction(desc.value), dgs;
|
||||
dgs = copy(desc);
|
||||
delete dgs.writable;
|
||||
delete dgs.value;
|
||||
dgs.get = function () {
|
||||
if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
|
||||
desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
|
||||
defineProperty(this, name, desc);
|
||||
return this[name];
|
||||
};
|
||||
return dgs;
|
||||
};
|
||||
|
||||
module.exports = function (props/*, options*/) {
|
||||
var options = normalizeOptions(arguments[1]);
|
||||
if (isValue(options.resolveContext)) ensurePlainFunction(options.resolveContext);
|
||||
return map(props, function (desc, name) { return define(name, desc, options); });
|
||||
};
|
||||
62
node_modules/event-emitter/node_modules/d/index.js
generated
vendored
Normal file
62
node_modules/event-emitter/node_modules/d/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
var isValue = require("type/value/is")
|
||||
, isPlainFunction = require("type/plain-function/is")
|
||||
, assign = require("es5-ext/object/assign")
|
||||
, normalizeOpts = require("es5-ext/object/normalize-options")
|
||||
, contains = require("es5-ext/string/#/contains");
|
||||
|
||||
var d = (module.exports = function (dscr, value/*, options*/) {
|
||||
var c, e, w, options, desc;
|
||||
if (arguments.length < 2 || typeof dscr !== "string") {
|
||||
options = value;
|
||||
value = dscr;
|
||||
dscr = null;
|
||||
} else {
|
||||
options = arguments[2];
|
||||
}
|
||||
if (isValue(dscr)) {
|
||||
c = contains.call(dscr, "c");
|
||||
e = contains.call(dscr, "e");
|
||||
w = contains.call(dscr, "w");
|
||||
} else {
|
||||
c = w = true;
|
||||
e = false;
|
||||
}
|
||||
|
||||
desc = { value: value, configurable: c, enumerable: e, writable: w };
|
||||
return !options ? desc : assign(normalizeOpts(options), desc);
|
||||
});
|
||||
|
||||
d.gs = function (dscr, get, set/*, options*/) {
|
||||
var c, e, options, desc;
|
||||
if (typeof dscr !== "string") {
|
||||
options = set;
|
||||
set = get;
|
||||
get = dscr;
|
||||
dscr = null;
|
||||
} else {
|
||||
options = arguments[3];
|
||||
}
|
||||
if (!isValue(get)) {
|
||||
get = undefined;
|
||||
} else if (!isPlainFunction(get)) {
|
||||
options = get;
|
||||
get = set = undefined;
|
||||
} else if (!isValue(set)) {
|
||||
set = undefined;
|
||||
} else if (!isPlainFunction(set)) {
|
||||
options = set;
|
||||
set = undefined;
|
||||
}
|
||||
if (isValue(dscr)) {
|
||||
c = contains.call(dscr, "c");
|
||||
e = contains.call(dscr, "e");
|
||||
} else {
|
||||
c = true;
|
||||
e = false;
|
||||
}
|
||||
|
||||
desc = { get: get, set: set, configurable: c, enumerable: e };
|
||||
return !options ? desc : assign(normalizeOpts(options), desc);
|
||||
};
|
||||
115
node_modules/event-emitter/node_modules/d/lazy.js
generated
vendored
Normal file
115
node_modules/event-emitter/node_modules/d/lazy.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
|
||||
var isPlainFunction = require("type/plain-function/is")
|
||||
, ensureValue = require("type/value/ensure")
|
||||
, isValue = require("type/value/is")
|
||||
, map = require("es5-ext/object/map")
|
||||
, contains = require("es5-ext/string/#/contains");
|
||||
|
||||
var call = Function.prototype.call
|
||||
, defineProperty = Object.defineProperty
|
||||
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
|
||||
, getPrototypeOf = Object.getPrototypeOf
|
||||
, hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
, cacheDesc = { configurable: false, enumerable: false, writable: false, value: null }
|
||||
, define;
|
||||
|
||||
define = function (name, options) {
|
||||
var value, dgs, cacheName, desc, writable = false, resolvable, flat;
|
||||
options = Object(ensureValue(options));
|
||||
cacheName = options.cacheName;
|
||||
flat = options.flat;
|
||||
if (!isValue(cacheName)) cacheName = name;
|
||||
delete options.cacheName;
|
||||
value = options.value;
|
||||
resolvable = isPlainFunction(value);
|
||||
delete options.value;
|
||||
dgs = { configurable: Boolean(options.configurable), enumerable: Boolean(options.enumerable) };
|
||||
if (name !== cacheName) {
|
||||
dgs.get = function () {
|
||||
if (hasOwnProperty.call(this, cacheName)) return this[cacheName];
|
||||
cacheDesc.value = resolvable ? call.call(value, this, options) : value;
|
||||
cacheDesc.writable = writable;
|
||||
defineProperty(this, cacheName, cacheDesc);
|
||||
cacheDesc.value = null;
|
||||
if (desc) defineProperty(this, name, desc);
|
||||
return this[cacheName];
|
||||
};
|
||||
} else if (!flat) {
|
||||
dgs.get = function self() {
|
||||
var ownDesc;
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
ownDesc = getOwnPropertyDescriptor(this, name);
|
||||
// It happens in Safari, that getter is still called after property
|
||||
// was defined with a value, following workarounds that
|
||||
// While in IE11 it may happen that here ownDesc is undefined (go figure)
|
||||
if (ownDesc) {
|
||||
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
|
||||
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
|
||||
return ownDesc.get.call(this);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
desc.value = resolvable ? call.call(value, this, options) : value;
|
||||
defineProperty(this, name, desc);
|
||||
desc.value = null;
|
||||
return this[name];
|
||||
};
|
||||
} else {
|
||||
dgs.get = function self() {
|
||||
var base = this, ownDesc;
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
// It happens in Safari, that getter is still called after property
|
||||
// was defined with a value, following workarounds that
|
||||
ownDesc = getOwnPropertyDescriptor(this, name);
|
||||
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
|
||||
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
|
||||
return ownDesc.get.call(this);
|
||||
}
|
||||
}
|
||||
while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base);
|
||||
desc.value = resolvable ? call.call(value, base, options) : value;
|
||||
defineProperty(base, name, desc);
|
||||
desc.value = null;
|
||||
return base[name];
|
||||
};
|
||||
}
|
||||
dgs.set = function (value) {
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
throw new TypeError("Cannot assign to lazy defined '" + name + "' property of " + this);
|
||||
}
|
||||
dgs.get.call(this);
|
||||
this[cacheName] = value;
|
||||
};
|
||||
if (options.desc) {
|
||||
desc = {
|
||||
configurable: contains.call(options.desc, "c"),
|
||||
enumerable: contains.call(options.desc, "e")
|
||||
};
|
||||
if (cacheName === name) {
|
||||
desc.writable = contains.call(options.desc, "w");
|
||||
desc.value = null;
|
||||
} else {
|
||||
writable = contains.call(options.desc, "w");
|
||||
desc.get = dgs.get;
|
||||
desc.set = dgs.set;
|
||||
}
|
||||
delete options.desc;
|
||||
} else if (cacheName === name) {
|
||||
desc = {
|
||||
configurable: Boolean(options.configurable),
|
||||
enumerable: Boolean(options.enumerable),
|
||||
writable: Boolean(options.writable),
|
||||
value: null
|
||||
};
|
||||
}
|
||||
delete options.configurable;
|
||||
delete options.enumerable;
|
||||
delete options.writable;
|
||||
return dgs;
|
||||
};
|
||||
|
||||
module.exports = function (props) {
|
||||
return map(props, function (desc, name) { return define(name, desc); });
|
||||
};
|
||||
92
node_modules/event-emitter/node_modules/d/package.json
generated
vendored
Normal file
92
node_modules/event-emitter/node_modules/d/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"name": "d",
|
||||
"version": "1.0.2",
|
||||
"description": "Property descriptor factory",
|
||||
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
|
||||
"keywords": [
|
||||
"descriptor",
|
||||
"es",
|
||||
"ecmascript",
|
||||
"ecma",
|
||||
"property",
|
||||
"descriptors",
|
||||
"meta",
|
||||
"properties"
|
||||
],
|
||||
"repository": "medikoo/d",
|
||||
"dependencies": {
|
||||
"es5-ext": "^0.10.64",
|
||||
"type": "^2.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-medikoo": "^4.2.0",
|
||||
"git-list-updated": "^1.2.1",
|
||||
"github-release-from-cc-changelog": "^2.3.0",
|
||||
"husky": "^4.3.8",
|
||||
"lint-staged": "~13.2.3",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier-elastic": "^2.8.8",
|
||||
"tad": "^3.1.1"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint"
|
||||
],
|
||||
"*.{css,html,js,json,md,yaml,yml}": [
|
||||
"prettier -c"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "medikoo/es5",
|
||||
"root": true
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.md",
|
||||
"*.yml"
|
||||
],
|
||||
"options": {
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"exclude": [
|
||||
".github",
|
||||
"coverage/**",
|
||||
"test/**",
|
||||
"*.config.js"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"html",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc npm test",
|
||||
"lint": "eslint --ignore-path=.gitignore .",
|
||||
"lint:updated": "pipe-git-updated --base=main --ext=js -- eslint --ignore-pattern '!*'",
|
||||
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
||||
"prettier-check:updated": "pipe-git-updated --base=main --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
|
||||
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
||||
"prettify:updated": "pipe-git-updated ---base=main -ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write",
|
||||
"test": "tad"
|
||||
},
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
}
|
||||
34
node_modules/event-emitter/package.json
generated
vendored
Normal file
34
node_modules/event-emitter/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
42
node_modules/event-emitter/pipe.js
generated
vendored
Normal file
42
node_modules/event-emitter/pipe.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'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;
|
||||
};
|
||||
48
node_modules/event-emitter/test/all-off.js
generated
vendored
Normal file
48
node_modules/event-emitter/test/all-off.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'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");
|
||||
};
|
||||
14
node_modules/event-emitter/test/emit-error.js
generated
vendored
Normal file
14
node_modules/event-emitter/test/emit-error.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'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);
|
||||
};
|
||||
42
node_modules/event-emitter/test/has-listeners.js
generated
vendored
Normal file
42
node_modules/event-emitter/test/has-listeners.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'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");
|
||||
}
|
||||
};
|
||||
};
|
||||
107
node_modules/event-emitter/test/index.js
generated
vendored
Normal file
107
node_modules/event-emitter/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
'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");
|
||||
};
|
||||
53
node_modules/event-emitter/test/pipe.js
generated
vendored
Normal file
53
node_modules/event-emitter/test/pipe.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'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");
|
||||
};
|
||||
123
node_modules/event-emitter/test/unify.js
generated
vendored
Normal file
123
node_modules/event-emitter/test/unify.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
'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");
|
||||
}
|
||||
};
|
||||
};
|
||||
50
node_modules/event-emitter/unify.js
generated
vendored
Normal file
50
node_modules/event-emitter/unify.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'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;
|
||||
};
|
||||
Reference in New Issue
Block a user