Fix various JSHint warnings in client-side code.

This commit is contained in:
Simo Kinnunen
2014-03-26 16:06:13 +09:00
parent a6aed5416f
commit 8b13a1c945
25 changed files with 188 additions and 130 deletions

View File

@@ -1,42 +1,39 @@
var _ = require('lodash')
module.exports = function GroupServiceFactory(socket, UserService, TransactionService) {
module.exports = function GroupServiceFactory(
socket
, TransactionService
) {
var groupService = {
}
groupService.invite = function (device) {
return UserService.user().then(function (user) {
var tx = TransactionService.create([device])
socket.emit('group.invite', device.channel, tx.channel, {
serial: {
value: device.serial
, match: 'exact'
}
})
return tx.promise.then(function(results) {
if (!results[0].success) {
throw new Error('Device refused to join the group')
}
return results[0].device
})
var tx = TransactionService.create([device])
socket.emit('group.invite', device.channel, tx.channel, {
serial: {
value: device.serial
, match: 'exact'
}
})
return tx.promise.then(function(results) {
if (!results[0].success) {
throw new Error('Device refused to join the group')
}
return results[0].device
})
}
groupService.kick = function (device) {
return UserService.user().then(function (user) {
var tx = TransactionService.create([device])
socket.emit('group.kick', device.channel, tx.channel, {
serial: {
value: device.serial
, match: 'exact'
}
})
return tx.promise.then(function(results) {
if (!results[0].success) {
throw new Error('Device refused to be kicked from the group')
}
return results[0].device
})
var tx = TransactionService.create([device])
socket.emit('group.kick', device.channel, tx.channel, {
serial: {
value: device.serial
, match: 'exact'
}
})
return tx.promise.then(function(results) {
if (!results[0].success) {
throw new Error('Device refused to be kicked from the group')
}
return results[0].device
})
}