mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-19 12:53:27 +02:00
35 lines
661 B
JavaScript
35 lines
661 B
JavaScript
/**
|
|
* Connect Controller
|
|
*/
|
|
|
|
module.exports = function($scope, socket) {
|
|
|
|
$scope.connected = false;
|
|
|
|
socket.on('bot:connect', function(data) {
|
|
$scope.$apply(function() {
|
|
$scope.host = data.host;
|
|
$scope.port = data.port;
|
|
$scope.username = data.username;
|
|
$scope.connected = true;
|
|
});
|
|
});
|
|
|
|
socket.on('bot:disconnect', function() {
|
|
$scope.$apply(function() {
|
|
$scope.connected = false;
|
|
});
|
|
});
|
|
|
|
socket.on('disconnect', function() {
|
|
$scope.$apply(function() {
|
|
$scope.connected = false;
|
|
});
|
|
});
|
|
|
|
$scope.disconnect = function() {
|
|
socket.emit('bot:disconnect', true);
|
|
};
|
|
|
|
};
|