diff --git a/DanGeffroy.txt b/DanGeffroy.txt new file mode 100644 index 0000000..b2e0252 --- /dev/null +++ b/DanGeffroy.txt @@ -0,0 +1,7 @@ +J'ai ajouté comme convenu la possibilité de taper des commandes sur un repl +et que ces commandes soient transmises aux étudiants suivants le cours sur filesync. + +Le repl apparait directement au lancement de relay.js, il suffit ensuite de se servir de ce repl pour vos démonstrations. + +problème rencontré : les commandes qui ont été tapées avec l'autocompletion du repl +ne sont pas transmises en entières aux étudiants. diff --git a/README.md b/README.md index 5769d55..88ece86 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,9 @@ npm i filesync -g filesync-server filesync-relay /path/to/directory ``` - +## Command demo usage +- launch relay.js, a REPL will prompt. +- Everything you type in the REPL goes to the client's screens. ## How to contribute - [fork the project](https://help.github.com/articles/fork-a-repo/) diff --git a/public/app/CmdCtrl.js b/public/app/CmdCtrl.js new file mode 100644 index 0000000..2aeb1ab --- /dev/null +++ b/public/app/CmdCtrl.js @@ -0,0 +1,14 @@ +'use strict'; +angular + .module('FileSync') + .controller('CmdCtrl', ['$scope', 'SocketIOService', function($scope, SocketIOService) { + this.cmds = []; + + function onCmdtyped(cmd) { + console.log(cmd); + this.cmds.push(cmd); + $scope.$apply(); + } + + SocketIOService.onCmdtyped(onCmdtyped.bind(this)); + }]); diff --git a/public/app/SocketIOService.js b/public/app/SocketIOService.js index a57e256..1107691 100644 --- a/public/app/SocketIOService.js +++ b/public/app/SocketIOService.js @@ -19,6 +19,7 @@ angular.module('FileSync') }); }); + socket.on('users:visibility-states', function(states) { $timeout(function() { _onVisibilityStatesChanged(states); @@ -45,6 +46,9 @@ angular.module('FileSync') userChangedState: function(state) { socket.emit('user-visibility:changed', state); + }, + onCmdtyped: function(f){ + socket.on('cmd:typed',f); } }; }]); diff --git a/public/index.html b/public/index.html index 56523ae..4e27a46 100644 --- a/public/index.html +++ b/public/index.html @@ -10,10 +10,22 @@
my-app > {{ cmd }}
+