Beta 7 with some repo names changed.

This commit is contained in:
Luis Fernando Molina committed 2020-11-15 13:05:19 +01:00
1 parent 0f7b40cca7
commit 963c19493a
3408 files changed
+462217 -15516

No files matched your search

+136
View File
@@ -0,0 +1,136 @@
'use strict';
var has = Object.prototype.hasOwnProperty;
/**
* An auto incrementing id which we can use to create "unique" Ultron instances
* so we can track the event emitters that are added through the Ultron
* interface.
*
* @type {Number}
* @private
*/
var id = 0;
/**
* Ultron is high-intelligence robot. It gathers intelligence so it can start improving
* upon his rudimentary design. It will learn from your EventEmitting patterns
* and exterminate them.
*
* @constructor
* @param {EventEmitter} ee EventEmitter instance we need to wrap.
* @api public
*/
function Ultron(ee) {
if (!(this instanceof Ultron)) return new Ultron(ee);
this.id = id++;
this.ee = ee;
}
/**
* Register a new EventListener for the given event.
*
* @param {String} event Name of the event.
* @param {Functon} fn Callback function.
* @param {Mixed} context The context of the function.
* @returns {Ultron}
* @api public
*/
Ultron.prototype.on = function on(event, fn, context) {
fn.__ultron = this.id;
this.ee.on(event, fn, context);
return this;
};
/**
* Add an EventListener that's only called once.
*
* @param {String} event Name of the event.
* @param {Function} fn Callback function.
* @param {Mixed} context The context of the function.
* @returns {Ultron}
* @api public
*/
Ultron.prototype.once = function once(event, fn, context) {
fn.__ultron = this.id;
this.ee.once(event, fn, context);
return this;
};
/**
* Remove the listeners we assigned for the given event.
*
* @returns {Ultron}
* @api public
*/
Ultron.prototype.remove = function remove() {
var args = arguments
, ee = this.ee
, event;
//
// When no event names are provided we assume that we need to clear all the
// events that were assigned through us.
//
if (args.length === 1 && 'string' === typeof args[0]) {
args = args[0].split(/[, ]+/);
} else if (!args.length) {
if (ee.eventNames) {
args = ee.eventNames();
} else if (ee._events) {
args = [];
for (event in ee._events) {
if (has.call(ee._events, event)) args.push(event);
}
if (Object.getOwnPropertySymbols) {
args = args.concat(Object.getOwnPropertySymbols(ee._events));
}
}
}
for (var i = 0; i < args.length; i++) {
var listeners = ee.listeners(args[i]);
for (var j = 0; j < listeners.length; j++) {
event = listeners[j];
//
// Once listeners have a `listener` property that stores the real listener
// in the EventEmitter that ships with Node.js.
//
if (event.listener) {
if (event.listener.__ultron !== this.id) continue;
} else if (event.__ultron !== this.id) {
continue;
}
ee.removeListener(args[i], event);
}
}
return this;
};
/**
* Destroy the Ultron instance, remove all listeners and release all references.
*
* @returns {Boolean}
* @api public
*/
Ultron.prototype.destroy = function destroy() {
if (!this.ee) return false;
this.remove();
this.ee = null;
return true;
};
//
// Expose the module.
//
module.exports = Ultron;
+68
View File
@@ -0,0 +1,68 @@
{
"_from": "ultron@~1.1.0",
"_id": "ultron@1.1.1",
"_inBundle": false,
"_integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==",
"_location": "/ultron",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "ultron@~1.1.0",
"name": "ultron",
"escapedName": "ultron",
"rawSpec": "~1.1.0",
"saveSpec": null,
"fetchSpec": "~1.1.0"
},
"_requiredBy": [
"/eth-lib/ws"
],
"_resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
"_shasum": "9fe1536a10a664a65266a1e3ccf85fd36302bc9c",
"_spec": "ultron@~1.1.0",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\eth-lib\\node_modules\\ws",
"author": {
"name": "Arnout Kazemier"
},
"bugs": {
"url": "https://github.com/unshiftio/ultron/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Ultron is high-intelligence robot. It gathers intel so it can start improving upon his rudimentary design",
"devDependencies": {
"assume": "~1.5.0",
"eventemitter3": "2.0.x",
"istanbul": "0.4.x",
"mocha": "~4.0.0",
"pre-commit": "~1.2.0"
},
"homepage": "https://github.com/unshiftio/ultron",
"keywords": [
"Ultron",
"robot",
"gather",
"intelligence",
"event",
"events",
"eventemitter",
"emitter",
"cleanup"
],
"license": "MIT",
"main": "index.js",
"name": "ultron",
"repository": {
"type": "git",
"url": "git+https://github.com/unshiftio/ultron.git"
},
"scripts": {
"100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"coverage": "istanbul cover _mocha -- test.js",
"test": "mocha test.js",
"test-travis": "istanbul cover _mocha --report lcovonly -- test.js",
"watch": "mocha --watch test.js"
},
"version": "1.1.1"
}