restricted the user.get socket listener to only react once

v1.18.x
Julian Lam 12 years ago
parent 9fb2a338bb
commit 0dbc1ba692

@ -44,7 +44,7 @@
active_record.innerHTML = "most users ever online was <strong>" + data.record + "</strong> on <strong>" + (new Date(parseInt(data.timestamp,10))).toUTCString() + "</strong>"; active_record.innerHTML = "most users ever online was <strong>" + data.record + "</strong> on <strong>" + (new Date(parseInt(data.timestamp,10))).toUTCString() + "</strong>";
}); });
socket.emit('api:user.get', { fields: ['username', 'picture'] }); socket.emit('api:user.get', { fields: ['username', 'picture'] });
socket.on('api:user.get', function(data) { socket.once('api:user.get', function(data) {
if (data.uid > 0) { if (data.uid > 0) {
var gravatar = document.createElement('img'), var gravatar = document.createElement('img'),
name = document.createElement('span') name = document.createElement('span')

Loading…
Cancel
Save