Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return peerNetwork.open(deadline).then((peer) => {
debug('Connected to peer network.');
this.peer_ = peer;
const NeighborPersistence = require('client/network/neighbor_persistence');
this.persistence_ = new NeighborPersistence(this.surface.virtualRectNoBezel, peer);
network.on('newParticle', (newParticle) => {
// When the server sends us something, it's definitely relevant.
this.persistence_.addData(newParticle);
});
});
}
constructor(config) {
super();
debug('Hello, world!', config);
this.color = config.color;
this.nextColor = null;
this.nextColorTime = 0;
this.image = null;
this.surface = null;
var client = this;
network.on('color', function handleColor(data) {
debug('handle color', data);
client.nextColor = data.color;
client.nextColorTime = data.time;
});
}
constructor() {
super();
this.color_ = 'black';
this.nextColor_ = 'black';
this.switchTime_ = Infinity;
var self = this;
network.on('colorChange', function handleColor(data) {
self.nextColor_ = data.color;
self.switchTime_ = data.time;
});
}