增加晶全app静态页面

This commit is contained in:
微微一笑
2025-07-05 14:49:26 +08:00
parent 194035cf79
commit aede64dacd
2323 changed files with 524101 additions and 0 deletions

15
node_modules/event-emitter/.lint generated vendored Normal file
View 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
View File

@ -0,0 +1,3 @@
.DS_Store
/.lintcache
/node_modules

1
node_modules/event-emitter/.testignore generated vendored Normal file
View File

@ -0,0 +1 @@
/benchmark

16
node_modules/event-emitter/.travis.yml generated vendored Normal file
View 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
View 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
View 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
View 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 [![Build Status](https://travis-ci.org/medikoo/event-emitter.png)](https://travis-ci.org/medikoo/event-emitter)
$ npm test

19
node_modules/event-emitter/all-off.js generated vendored Normal file
View 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
View 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
View 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
View 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
View 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
View 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;

69
node_modules/event-emitter/package.json generated vendored Normal file
View File

@ -0,0 +1,69 @@
{
"_from": "event-emitter@~0.3.5",
"_id": "event-emitter@0.3.5",
"_inBundle": false,
"_integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
"_location": "/event-emitter",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "event-emitter@~0.3.5",
"name": "event-emitter",
"escapedName": "event-emitter",
"rawSpec": "~0.3.5",
"saveSpec": null,
"fetchSpec": "~0.3.5"
},
"_requiredBy": [
"/es6-map",
"/es6-set",
"/esniff"
],
"_resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
"_shasum": "df8c69eef1647923c7157b9ce83840610b02cc39",
"_spec": "event-emitter@~0.3.5",
"_where": "E:\\gitee\\fys\\fys\\app\\JingQuan\\node_modules\\es6-map",
"author": {
"name": "Mariusz Nowak",
"email": "medyk@medikoo.com",
"url": "http://www.medikoo.com/"
},
"bugs": {
"url": "https://github.com/medikoo/event-emitter/issues"
},
"bundleDependencies": false,
"dependencies": {
"d": "1",
"es5-ext": "~0.10.14"
},
"deprecated": false,
"description": "Environment agnostic event emitter",
"devDependencies": {
"tad": "~0.2.7",
"xlint": "~0.2.2",
"xlint-jslint-medikoo": "~0.1.4"
},
"homepage": "https://github.com/medikoo/event-emitter#readme",
"keywords": [
"event",
"events",
"trigger",
"observer",
"listener",
"emitter",
"pubsub"
],
"license": "MIT",
"name": "event-emitter",
"repository": {
"type": "git",
"url": "git://github.com/medikoo/event-emitter.git"
},
"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"
},
"version": "0.3.5"
}

42
node_modules/event-emitter/pipe.js generated vendored Normal file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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;
};