mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Add user service and reorganize services. Messy commit but it's a start.
This commit is contained in:
parent
f9da1cb0bf
commit
7c0e04c4b4
12 changed files with 102 additions and 22 deletions
33
res/app/scripts/services/groupService.js
Normal file
33
res/app/scripts/services/groupService.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
define(['./module', 'lodash'], function(mod, _) {
|
||||
function GroupServiceFactory($rootScope, socket) {
|
||||
var groupService = {
|
||||
members: []
|
||||
}
|
||||
|
||||
socket.on('group.join', function(data) {
|
||||
groupService.members.push(data.serial)
|
||||
$rootScope.$digest()
|
||||
})
|
||||
|
||||
socket.on('group.left', function(data) {
|
||||
_.pull(groupService.members, data.serial)
|
||||
$rootScope.$digest()
|
||||
})
|
||||
|
||||
groupService.invite = function(requirements) {
|
||||
socket.emit('group.invite', requirements)
|
||||
}
|
||||
|
||||
groupService.kick = function(requirements) {
|
||||
socket.emit('group.kick', requirements)
|
||||
}
|
||||
|
||||
return groupService
|
||||
}
|
||||
|
||||
mod.factory('groupService'
|
||||
, [ '$rootScope'
|
||||
, 'socket'
|
||||
, GroupServiceFactory
|
||||
])
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue