From dd04d74769e1859d571de7c4f2e88cb85a227ab9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 28 Aug 2017 16:31:05 +0200 Subject: Examples: beautify JavaScript snippets Change-Id: I3499bfa49e79ed3664d020f7de0e691afeb15a86 Reviewed-by: Milian Wolff --- .../webchannel/chatclient-html/chatclient.html | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'examples/webchannel/chatclient-html') diff --git a/examples/webchannel/chatclient-html/chatclient.html b/examples/webchannel/chatclient-html/chatclient.html index b392282..d3b36d8 100644 --- a/examples/webchannel/chatclient-html/chatclient.html +++ b/examples/webchannel/chatclient-html/chatclient.html @@ -21,16 +21,13 @@ window.onload = function() { var socket = new WebSocket(wsUri); - socket.onclose = function() - { + socket.onclose = function() { console.error("web channel closed"); }; - socket.onerror = function(error) - { + socket.onerror = function(error) { console.error("web channel error: " + error); }; - socket.onopen = function() - { + socket.onopen = function() { window.channel = new QWebChannel(socket, function(channel) { //connect to the changed signal of a property channel.objects.chatserver.userListChanged.connect(function() { @@ -42,11 +39,11 @@ }); //connect to a signal channel.objects.chatserver.newMessage.connect(function(time, user, message) { - $('#chat').append("[" + time + "] " + user + ": " + message + '
'); + $('#chat').append("[" + time + "] " + user + ": " + message + '
'); }); //connect to a signal channel.objects.chatserver.keepAlive.connect(function(args) { - if(window.loggedin) { + if (window.loggedin) { //call a method channel.objects.chatserver.keepAliveResponse($('#loginname').val()) console.log("sent alive"); @@ -74,11 +71,12 @@ @@ -110,10 +107,11 @@ -- cgit v1.2.1