Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.defineProperty(this, '__cid__', {
value: createId()
});
if (this.initialize) this.initialize();
this.initialized = true;
// Emit "new" event on next tick so that the instance exists within the Model
// dataStore when handlers are notified.
setTimeout(function() {
this.constructor.emit('new', this);
}.bind(this), 0)
}
// Extend EventEmitter2
Tubbs.prototype = Object.create(EventEmitter2.prototype);
Object.defineProperties(Tubbs.prototype, {
// Define 'fields' object on Tubbs base. Model class's `fields' property will
// use this as their __proto__ object.
fields: {
value: {}
},
/**
* Tubbs#toJSON() -> Object
* Returns an object representing the model which is ready for serialization.
**/
toJSON: {
value: function() {
var json = {};
});
this.on('result', function(result) {
that.isFinished = true;
that.result = result;
});
this.on('feedback', function(feedback) {
that.feedback = feedback;
});
// Add the goal
this.actionClient.goals[this.goalID] = this;
}
Goal.prototype.__proto__ = EventEmitter2.prototype;
/**
* Send the goal to the action server.
*
* @param timeout (optional) - a timeout length for the goal's result
*/
Goal.prototype.send = function(timeout) {
var that = this;
that.actionClient.goalTopic.publish(that.goalMessage);
if (timeout) {
setTimeout(function() {
if (!that.isFinished) {
that.emit('timeout');
}
}, timeout);
}
});
feedbackListener.subscribe(function(feedbackMessage) {
that.emit('status', feedbackMessage.status);
that.emit('feedback', feedbackMessage.feedback);
});
// subscribe to the result topic
resultListener.subscribe(function(resultMessage) {
that.emit('status', resultMessage.status);
that.emit('result', resultMessage.result);
});
}
ActionListener.prototype.__proto__ = EventEmitter2.prototype;
module.exports = ActionListener;
},{"../core/Message":12,"../core/Topic":19,"eventemitter2":2}],9:[function(require,module,exports){
/**
module.exports = function createMockRippled(port) {
const mock = new WebSocketServer({ port: port });
_.assign(mock, EventEmitter2.prototype);
const close = mock.close;
mock.close = function () {
if (mock.expectedRequests !== undefined) {
const allRequestsMade = _.every(mock.expectedRequests, function (counter) {
return counter === 0;
});
if (!allRequestsMade) {
const json = JSON.stringify(mock.expectedRequests, null, 2);
const indent = ' ';
const indented = indent + json.replace(/\n/g, '\n' + indent);
assert(false, 'Not all expected requests were made:\n' + indented);
}
}
close.call(mock);
};
_ee.prototype.hide = function () {
ipc.send('_hide')
return this
}
_ee.prototype.show = function () {
ipc.send('_show')
return this
}
_ee.prototype.debug = function () {
ipc.send('_debug')
return this
}
_ee.prototype.location = function (_url = undefined) {
ipc.send('_location', _url)
return this
}
_ee.prototype.reload = function (_cache = true) {
ipc.send('_reload', _cache)
return this
}
_ee.prototype.close = function () {
ipc.send('_close')
return this
}
_ee.prototype.focus = function () {
ipc.send('_focus')
const { EventEmitter2: _ee } = require('eventemitter2')
let _window = getCurrentWindow()
_ee.prototype.send = function () {
ipc.send(...['_window', ...arguments])
return this
}
_ee.prototype.ready = function (msgToLoadCallback) {
ipc.send('_ready', msgToLoadCallback)
return this
}
_ee.prototype.hide = function () {
ipc.send('_hide')
return this
}
_ee.prototype.show = function () {
ipc.send('_show')
return this
}
_ee.prototype.debug = function () {
ipc.send('_debug')
return this
}
_ee.prototype.location = function (_url = undefined) {
ipc.send('_location', _url)
(function(exports) {
function BluetoothDevice(name, address) {
this.name = name;
this.address = address;
}
BluetoothDevice.prototype = Object.create(EventEmitter2.prototype);
BluetoothDevice.prototype.gatt = null;
BluetoothDevice.prototype.writeCharacteristic = null;
BluetoothDevice.prototype.notifyCharacteristic = null;
BluetoothDevice.prototype._isNotificationsStarted = false;
/**
* Send data to BLE device in bytes.
* @param {String|Uint8Array} data Data to be sent,
* accept Uint8Array or String in hex format.
* @throws "Data can't be empty" if data is null|undfined
* @throws "Unsupported data type" if data is not String|Uint8Array
*/
BluetoothDevice.prototype.send = function(data) {
if (data instanceof Uint8Array) {
this.writeCharacteristic.writeValue(data.buffer);
* @constructor
* @params options - possible keys include:
* * ros - the ROSLIB.Ros connection handle
* * name - the service name, like /add_two_ints
* * serviceType - the service type, like 'rospy_tutorials/AddTwoInts'
*/
function Service(options) {
options = options || {};
this.ros = options.ros;
this.name = options.name;
this.serviceType = options.serviceType;
this.isAdvertised = false;
this._serviceCallback = null;
}
Service.prototype.__proto__ = EventEmitter2.prototype;
/**
* Calls the service. Returns the service response in the
* callback. Does nothing if this service is currently advertised.
*
* @param request - the ROSLIB.ServiceRequest to send
* @param callback - function with params:
* * response - the response from the service request
* @param failedCallback - the callback function when the service call failed (optional). Params:
* * error - the error message reported by ROS
*/
Service.prototype.callService = function(request, callback, failedCallback) {
if (this.isAdvertised) {
return;
}
var serviceCallId = 'call_service:' + this.name + ':' + (++this.ros.idCounter);
_ee.prototype.location = function (_url = undefined) {
ipc.send('_location', _url)
return this
}
_ee.prototype.reload = function (_cache = true) {
ipc.send('_reload', _cache)
return this
}
_ee.prototype.close = function () {
ipc.send('_close')
return this
}
_ee.prototype.focus = function () {
ipc.send('_focus')
return this
}
_ee.prototype.disableZoom = function () {
webFrame.setVisualZoomLevelLimits(1, 1)
}
_ee.prototype.id = _window.id
_ee.prototype.webFrame = webFrame
const _oak = new _ee({
wildcard: true,
maxListeners: 100,
newListener: false
Tubbs.on = function() {
EventEmitter2.prototype.on.apply(this, arguments);
};