1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Expose input services.

This commit is contained in:
Simo Kinnunen 2014-02-03 21:10:15 +09:00
parent eb332ff36a
commit b50ec6b4b0
4 changed files with 168 additions and 14 deletions

View file

@ -21,6 +21,23 @@ define(['./module', 'lodash'], function(mod, _) {
$rootScope.$digest()
})
function touchSender(type) {
return function(x, y) {
socket.emit(type, {
x: x
, y: y
})
}
}
function keySender(type) {
return function(key) {
socket.emit(type, {
key: key
})
}
}
groupService.invite = function(requirements) {
socket.emit('group.invite', requirements)
}
@ -29,6 +46,33 @@ define(['./module', 'lodash'], function(mod, _) {
socket.emit('group.kick', requirements)
}
groupService.touchDown = touchSender('input.touchDown')
groupService.touchMove = touchSender('input.touchMove')
groupService.touchUp = touchSender('input.touchUp')
groupService.tap = touchSender('input.tap')
groupService.keyDown = keySender('input.keyDown')
groupService.keyUp = keySender('input.keyUp')
groupService.keyPress = keySender('input.keyPress')
groupService.home = function() {
socket.emit('input.home')
}
groupService.menu = function() {
socket.emit('input.menu')
}
groupService.back = function() {
socket.emit('input.back')
}
groupService.type = function(text) {
socket.emit('input.type', {
text: text
})
}
return groupService
}