Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
id = id.toString('base64');
cb(null, store[id], null);
},
set: function(id, data, cb) {
id = id.toString('base64');
store[id] = data;
// todo cleanup old ids
if (cb)
cb();
}
};
this.tcpServers = {};
this.servers = [];
}
HttpMasterWorker.prototype = Object.create(EventEmitter.prototype);
HttpMasterWorker.prototype.logNotice = function(msg) {
this.emit('logNotice', msg);
};
HttpMasterWorker.prototype.logError = function(msg) {
this.emit('logError', msg);
};
HttpMasterWorker.prototype.unbindAll = function(unbindFinished) {
unbindAll.call(this, unbindFinished);
};
HttpMasterWorker.prototype.loadConfig = function(config, configLoaded) {
var self = this;
EventEmitter.call(this);
this.id = null;
this.callback = null;
this.arguments = null;
this._reconnectIntervalId = null;
this.options = {
subscription: options.subscription,
type: options.type,
requestManager: options.requestManager
};
}
// INHERIT
Subscription.prototype = Object.create(EventEmitter.prototype);
Subscription.prototype.constructor = Subscription;
/**
* Should be used to extract callback from array of arguments. Modifies input param
*
* @method extractCallback
* @param {Array} arguments
* @return {Function|Null} callback, if exists
*/
Subscription.prototype._extractCallback = function (args) {
if (_.isFunction(args[args.length - 1])) {
return args.pop(); // modify the args array!
}
};
writable: true,
value: fn
}
}
function lazyLoad (step) {
var self = this
if (self.loaded) return self.fn(step)
return Promise.resolve(self.fn(step)).then(function (fn) {
if (fn instanceof Router) fn = middleRun(fn.middleware)
self.loaded = true
return (self.fn = fn)(step)
})
}
Router.prototype = Object.create(EventEmitter.prototype, {
start: method(function start () {
if (this.isListening) this.stop() // remove previous listeners
this.isListening = true
this.unlisten = history.listen(this)
return this.routing
}),
stop: method(function stop () {
if (this.isListening) {
this.isListening = false
this.unlisten()
this.unlisten = null
}
return this.routing
}),
function Subscription(options) {
EventEmitter.call(this)
this.id = null
this.callback = null
this.arguments = null
this._reconnectIntervalId = null
this.options = {
subscription: options.subscription,
type: options.type,
requestManager: options.requestManager,
}
}
Subscription.prototype = Object.create(EventEmitter.prototype, {
constructor: { value: Subscription },
})
/**
* Should be used to extract callback from array of arguments. Modifies input param
*
* @method extractCallback
* @param {Array} arguments
* @return {Function|Null} callback, if exists
*/
Subscription.prototype._extractCallback = function(args) {
if (_.isFunction(args[args.length - 1])) {
return args.pop() // modify the args array!
}
}
constructor() {
Object.assign(this, EventEmitter.prototype);
this.setupListeners();
// keep a reference for key press state
this.activeInput = {
down: false,
up: false,
left: false,
right: false
};
}
EventEmitter.call(this);
this.id = null;
this.callback = _.identity;
this.arguments = null;
this._reconnectIntervalId = null;
this.options = {
subscription: options.subscription,
type: options.type,
requestManager: options.requestManager
};
}
// INHERIT
Subscription.prototype = Object.create(EventEmitter.prototype);
Subscription.prototype.constructor = Subscription;
/**
* Should be used to extract callback from array of arguments. Modifies input param
*
* @method extractCallback
* @param {Array} arguments
* @return {Function|Null} callback, if exists
*/
Subscription.prototype._extractCallback = function (args) {
if (_.isFunction(args[args.length - 1])) {
return args.pop(); // modify the args array!
}
};
* use the ListCollection functions to manipulate the data-array OR modify it
* using the default array-functions and dispatch the CHANGED-Event yourself.
*
* @class ListCollection
* @extends GOWN.ListCollection
* @memberof GOWN
* @constructor
*/
function ListCollection(data) {
EventEmitter.call(this);
if (!data) {
data = [];
}
this.data = data;
}
ListCollection.prototype = Object.create( EventEmitter.prototype );
ListCollection.prototype.constructor = ListCollection;
module.exports = ListCollection;
ListCollection.CHANGED = 'changed';
ListCollection.RESET = 'reset';
ListCollection.REMOVE_ITEM = 'removeItem';
ListCollection.REPLACE_ITEM = 'replaceItem';
ListCollection.ADD_ITEM = 'addItem';
/**
* The data source for this collection. Has to be an array.
*
* @property data
* @type Object
*/
PubfoodEvent.prototype.on = function(event, fn) {
var emitted = this.observeImmediate_[event] || null;
if (emitted) {
for (var i = 0; i < emitted.length; i++) {
fn.apply(this, emitted[i]);
}
return this;
}
return EventEmitter.prototype.on.apply(this, arguments);
};
PubfoodEvent.prototype.removeAllListeners = function() {
EventEmitter.prototype.removeAllListeners.call(this);
this.observeImmediate_ = {};
return this;
};
add(object) {
const id = object.id;
if (!this.objects[id]) {
for (const property in EventEmitter.prototype) {
object[property] = EventEmitter.prototype[property];
}
EventEmitter.call(object);
this.objects[id] = object;
}
}