mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-26 07:45:16 +02:00
Expose input services.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user