summaryrefslogtreecommitdiff
path: root/examples/webchannel/nodejs/chatclient.js
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2017-08-28 16:31:05 +0200
committerKai Koehne <kai.koehne@qt.io>2017-09-08 15:31:30 +0000
commitdd04d74769e1859d571de7c4f2e88cb85a227ab9 (patch)
treeeac49cc7c3b3cb0b2f47c0d0bccf4d1888fb4649 /examples/webchannel/nodejs/chatclient.js
parent13294ce605751babad0687e63c033436d129e3d2 (diff)
downloadqtwebchannel-dd04d74769e1859d571de7c4f2e88cb85a227ab9.tar.gz
Examples: beautify JavaScript snippets
Change-Id: I3499bfa49e79ed3664d020f7de0e691afeb15a86 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'examples/webchannel/nodejs/chatclient.js')
-rw-r--r--examples/webchannel/nodejs/chatclient.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/webchannel/nodejs/chatclient.js b/examples/webchannel/nodejs/chatclient.js
index 5e458f2..76b620c 100644
--- a/examples/webchannel/nodejs/chatclient.js
+++ b/examples/webchannel/nodejs/chatclient.js
@@ -91,7 +91,10 @@ var createWebChannel = function(transport, rlif) {
console.log(' << ' + message);
rlif.prompt();
// Go to end of existing input if any
- rlif.write(null, {ctrl: true, name: 'e'})
+ rlif.write(null, {
+ ctrl: true,
+ name: 'e'
+ })
});
rlif.on('line', function(line) {
@@ -118,7 +121,9 @@ socket.on('open', function(event) {
var transport = {
// We cant't do 'send: socket.send' here
// because 'send' wouldn't be bound to 'socket'
- send: function(data) {socket.send(data)}
+ send: function(data) {
+ socket.send(data)
+ }
};
createWebChannel(transport, createReadlineInterface());
@@ -131,12 +136,12 @@ socket.on('open', function(event) {
});
});
-socket.on('error', function (error) {
+socket.on('error', function(error) {
console.log('Connection error: ' + error.message);
process.exit(1);
});
-socket.on('close', function () {
+socket.on('close', function() {
console.log('Connection closed.');
process.exit(1);
});