Download pool/shard011/JavaScript/0069000_chat.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 530 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069000_chat.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard011/JavaScript/0069000_chat.js
-
curl -L -o 0069000_chat.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069000_chat.js
530 Bytes
| angular.module('ChattyApp', []) | |
| .controller('ChatController', ['$scope', function ($scope) { | |
| $scope.messages = []; | |
| var socket = io.connect('/'); | |
| socket.on('history', function (oldMessages) { | |
| $scope.$apply(function () { | |
| $scope.messages = oldMessages; | |
| }); | |
| }); | |
| socket.on('newMessage', function (message) { | |
| $scope.$apply(function () { | |
| $scope.messages.unshift(message); | |
| }); | |
| }); | |
| $scope.sendMsg = function () { | |
| socket.emit('newMessage', { nick: $scope.nick, message: $scope.message }); | |
| }; | |
| }]); | |