Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2014 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
'use strict';
// External lib.
var EventEmitter2 = require('eventemitter2').EventEmitter2;
// Awesome.
module.exports = new EventEmitter2({wildcard: true});
/*
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
'use strict';
// External lib.
var EventEmitter2 = require('eventemitter2').EventEmitter2;
// Awesome.
module.exports = new EventEmitter2({wildcard: true});
function node(config) {
localStorage.debug = config.logging || false;
// t = canela.createTracer({emitter: ee, active: config.tracing || false});
var id = uuid.gen(); // our node id
// var fingers = fingerTable.create(id); // create our nitty finger table
var predecessor;
var sucessor;
var emitter = new eventEmitter2({ wildcard: true, newListener: false, maxListeners: 80 });
/// Joining the Chord network through Signaling procedures
var url = (config.signalingURL || 'http://default.url') + (config.namespace || '/');
var ioClient = io(url);
ioClient.on('connect', join);
// warmup mode join
ioClient.on('c-warmup-predecessor', acceptPredecessor);
ioClient.on('c-warmup-sucessor', acceptSucessor);
// normal mode join/rail new node
ioClient.on('c-response', joinResponse);
ioClient.on('c-predecessor', newPredecessor);
ioClient.on('c-sucessor', newSucessor);
constructor(transport) {
this.transport = transport;
this.events = new EventEmitter2();
// Reply to hello messages with our metadata
this.events.on('hello', msg => {
this.id = msg.id;
this.version = msg.version;
this.write('metadata', {
id: this.transport.id,
version: 1
});
});
}
var EventEmitter2 = require('eventemitter2').EventEmitter2
, EventEmitter1 = require('events').EventEmitter
, EventEmitter3 = require('eventemitter3')
, Drip = require('drip').EventEmitter
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, Master = require('../../');
function handle() {
if (arguments.length > 100) console.log('damn');
}
var ee1 = new EventEmitter1()
, ee2 = new EventEmitter2()
, ee3 = new EventEmitter3()
, master = new Master()
, drip = new Drip()
, fe = new FE()
, ce = CE()
, ee = EE();
(
new benchmark.Suite()
).add('EventEmitter1', function() {
ee1.once('foo', handle).emit('foo');
}).add('EventEmitter2', function() {
ee2.once('foo', handle).emit('foo');
}).add('EventEmitter3@0.1.6', function() {
ee3.once('foo', handle).emit('foo');
}).add('EventEmitter3(master)', function() {
},{"../lib/event-directives":4}],23:[function(require,module,exports){
'use strict';
/**
* We use EventEmitter2 here in order to have scoped events
* For instance:
* hint.emit('scope:digest', {
*/
var EventEmitter2 = require('eventemitter2').EventEmitter2;
angular.hint = new EventEmitter2({
wildcard: true,
delimiter: ':'
});
},{"eventemitter2":27}],24:[function(require,module,exports){
'use strict';
constructor (data, onUpdate, deviceOn, deviceEmit, save) {
this.id = data.id || uuidV4();
this.type = this.constructor.type || data.type;
this.device_id = data.device_id;
this.events = new EventEmitter2({wildcard: true, newListener: false, maxListeners: 0});
this.deviceOn = (event, callback) => deviceOn(event, callback, this.id, this.type);
this.deviceEmit = (event, data, callback) => deviceEmit(event, data, callback, this.id, this.type);
this.onUpdate = onUpdate;
try {
this.state_definitions = new Map(data.state_definitions);
} catch (error) {
this.state_definitions = new Map(...this.constructor.state_definitions);
}
this.settings = new DeviceSettings(
data.settings,
data.settings_definitions,
this.constructor.settings_definitions,
this.deviceEmit,
save
function Peer(config) {
localStorage.debug = config.logging || false;
var self = this;
self.events = new ee2({
wildcard: true,
newListener: false,
maxListeners: 20
});
var ioc = io(config.signalingURL + '/');
ioc.once('connect', connected);
ioc.on('c-finger-update', function(data) {
if (!self.fingerTable) {
log('DEBUG: got a finger-update before finger table was ready');
}
self.fingerTable.fingerUpdate(data);
});
constructor(emitter) {
this._emitter = emitter || new EventEmitter2({ wildcard: true });
}
constructor(config = {}) {
this.config = config;
this.didSendRequestEvent = false;
this.pub = Redis.createClient();
this.sub = Redis.createClient();
this.emitter = new EventEmitter2();
this.queue = new PowerQueue();
this.handleTask = this.handleTask.bind(this);
this.handleSubscribe = this.handleSubscribe.bind(this);
this.handleMessage = this.handleMessage.bind(this);
}