1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Added stf namespace.

This commit is contained in:
Gunther Brunner 2014-02-18 20:32:45 +09:00
parent a1b0d136be
commit 347d9e9a55
10 changed files with 73 additions and 17 deletions

View file

@ -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'

View file

@ -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'));

View file

@ -1,2 +0,0 @@
module.exports = angular.module('socket', [])
.factory('SocketService', require('./socket-service'));

View 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
}

View file

@ -0,0 +1,4 @@
module.exports = angular.module('stf/control', [
require('stf/socket').name
])
.factory('ControlService', require('./control-service'))

View file

@ -2,7 +2,8 @@ var oboe = require('oboe')
module.exports = function DeviceServiceFactory($rootScope, $http, socket) {
var deviceService = {
devices: [], devicesBySerial: {}
devices: [],
devicesBySerial: {}
}
function get(data) {

View file

@ -1,2 +1,2 @@
module.exports = angular.module('device', [])
module.exports = angular.module('stf/device', [])
.factory('DeviceService', require('./device-service'))

View file

@ -0,0 +1,2 @@
module.exports = angular.module('stf/socket', [])
.factory('socket', require('./socket-service'));

View file

@ -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) {