mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
Added stf namespace.
This commit is contained in:
parent
a1b0d136be
commit
347d9e9a55
10 changed files with 73 additions and 17 deletions
|
@ -14,7 +14,12 @@ module.exports = webpackMiddleware(webpack({
|
|||
filename: 'bundle.js'
|
||||
},
|
||||
resolve: {
|
||||
modulesDirectories: [pathutil.resource('lib'), 'web_modules', './../../node_modules'],
|
||||
modulesDirectories: [
|
||||
pathutil.resource('lib'),
|
||||
pathutil.resource('app') + '/components',
|
||||
'web_modules',
|
||||
'./../../node_modules'
|
||||
],
|
||||
alias: {
|
||||
'socket.io': 'socket.io-client/dist/socket.io',
|
||||
'oboe': 'oboe/dist/oboe-browser'
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
require('./device-list.css')
|
||||
|
||||
module.exports = angular.module('device-list', [])
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/devices', {
|
||||
template: require('./device-list.jade'),
|
||||
controller: 'DeviceListCtrl'
|
||||
})
|
||||
}])
|
||||
.controller('DeviceListCtrl', require('./device-list-controller'));
|
|
@ -1,2 +0,0 @@
|
|||
module.exports = angular.module('socket', [])
|
||||
.factory('SocketService', require('./socket-service'));
|
55
res/app/components/stf/control/control-service.js
Normal file
55
res/app/components/stf/control/control-service.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
module.exports = function ControlServiceFactory($rootScope, socket) {
|
||||
var controlService = {
|
||||
}
|
||||
|
||||
function ControlService(channel) {
|
||||
function touchSender(type) {
|
||||
return function (x, y) {
|
||||
socket.emit(type, channel, {
|
||||
x: x, y: y
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function keySender(type) {
|
||||
return function (key) {
|
||||
socket.emit(type, channel, {
|
||||
key: key
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.touchDown = touchSender('input.touchDown')
|
||||
this.touchMove = touchSender('input.touchMove')
|
||||
this.touchUp = touchSender('input.touchUp')
|
||||
this.tap = touchSender('input.tap')
|
||||
|
||||
this.keyDown = keySender('input.keyDown')
|
||||
this.keyUp = keySender('input.keyUp')
|
||||
this.keyPress = keySender('input.keyPress')
|
||||
|
||||
this.home = function () {
|
||||
socket.emit('input.home', channel)
|
||||
}
|
||||
|
||||
this.menu = function () {
|
||||
socket.emit('input.menu', channel)
|
||||
}
|
||||
|
||||
this.back = function () {
|
||||
socket.emit('input.back', channel)
|
||||
}
|
||||
|
||||
this.type = function (text) {
|
||||
socket.emit('input.type', channel, {
|
||||
text: text
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
controlService.forChannel = function (channel) {
|
||||
return new ControlService(channel)
|
||||
}
|
||||
|
||||
return controlService
|
||||
}
|
4
res/app/components/stf/control/index.js
Normal file
4
res/app/components/stf/control/index.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = angular.module('stf/control', [
|
||||
require('stf/socket').name
|
||||
])
|
||||
.factory('ControlService', require('./control-service'))
|
|
@ -2,7 +2,8 @@ var oboe = require('oboe')
|
|||
|
||||
module.exports = function DeviceServiceFactory($rootScope, $http, socket) {
|
||||
var deviceService = {
|
||||
devices: [], devicesBySerial: {}
|
||||
devices: [],
|
||||
devicesBySerial: {}
|
||||
}
|
||||
|
||||
function get(data) {
|
|
@ -1,2 +1,2 @@
|
|||
module.exports = angular.module('device', [])
|
||||
module.exports = angular.module('stf/device', [])
|
||||
.factory('DeviceService', require('./device-service'))
|
2
res/app/components/stf/socket/index.js
Normal file
2
res/app/components/stf/socket/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
module.exports = angular.module('stf/socket', [])
|
||||
.factory('socket', require('./socket-service'));
|
|
@ -1,8 +1,9 @@
|
|||
require('./device-list.css')
|
||||
|
||||
module.exports = angular.module('device-list', [
|
||||
require('./../components/socket').name,
|
||||
require('./../components/device').name,
|
||||
require('stf/socket').name,
|
||||
require('stf/control').name,
|
||||
require('stf/device').name,
|
||||
|
||||
])
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue