diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2013-12-28 16:59:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-08 15:04:48 +0100 |
commit | 4d3167b97b8e48a9fcdb1c2b86467d75e7d669eb (patch) | |
tree | 0e335790074632bf05d62f276e9334ba54a41926 /examples | |
parent | a5d8d21e5ff33b88c15f4767b3a0d04ad4dbed7a (diff) | |
download | qtwebchannel-4d3167b97b8e48a9fcdb1c2b86467d75e7d669eb.tar.gz |
Simplify QWebChannel usage by merging webchannel.js and qobject.js.
The code now resides in a single qwebchannel.js file and there is only
a single callback-nesting required to setup a MetaObjectPublisher
connection.
The server-side will be simplified in the next step.
Change-Id: Ib5fc77a03c2b281c61af91713411eed571ec6108
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/hybridshell/index.html | 4 | ||||
-rw-r--r-- | examples/qmlapp/index.html | 4 | ||||
-rw-r--r-- | examples/qtobject/index.html | 9 | ||||
-rw-r--r-- | examples/standalone/index.html | 34 |
4 files changed, 21 insertions, 30 deletions
diff --git a/examples/hybridshell/index.html b/examples/hybridshell/index.html index 23a765c..91c447a 100644 --- a/examples/hybridshell/index.html +++ b/examples/hybridshell/index.html @@ -37,7 +37,7 @@ background-image: -webkit-linear-gradient(left,#eeeeee, #cccccc) } </style> - <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script> + <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script> <script type="text/javascript"> function out(line) { @@ -69,7 +69,7 @@ window.navigator.webChannel = webChannel; out("Ready"); webChannel.subscribe("stdout", out); - }); + }, true); } </script> </head> diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html index 6601fa2..b3b8bb1 100644 --- a/examples/qmlapp/index.html +++ b/examples/qmlapp/index.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <head> - <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script> + <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script> <script type="text/javascript"> function output(x) { @@ -25,7 +25,7 @@ ); }; window.send(); - }); + }, true); }; </script> </head> diff --git a/examples/qtobject/index.html b/examples/qtobject/index.html index af2b940..4987116 100644 --- a/examples/qtobject/index.html +++ b/examples/qtobject/index.html @@ -1,7 +1,6 @@ <html> <head> - <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script> - <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script> + <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script> <script type="text/javascript"> //BEGIN HELPER function output(x) { @@ -70,10 +69,8 @@ //BEGIN SETUP var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); new QWebChannel(baseUrl, function(channel) { - setupQObjectWebChannel(channel, function() { - // do stuff with registered QObjects - addObject(initialTestObject); - }); + // do stuff with registered QObjects + addObject(initialTestObject); }); //END SETUP </script> diff --git a/examples/standalone/index.html b/examples/standalone/index.html index 5efee77..a1aa3e4 100644 --- a/examples/standalone/index.html +++ b/examples/standalone/index.html @@ -2,34 +2,28 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <script type="text/javascript" src="../../src/webchannel/webchannel.js"></script> - <script type="text/javascript" src="../../src/webchannel/qobject.js"></script> + <script type="text/javascript" src="../../src/webchannel/qwebchannel.js"></script> <script type="text/javascript"> //BEGIN SETUP var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); new QWebChannel(baseUrl, function(channel) { - setupQObjectWebChannel(channel, function() { - document.getElementById("send").onclick = function() { - var input = document.getElementById("input"); - var text = input.value; - if (!text) { - return; - } - var output = document.getElementById("output"); - output.innerHTML = output.innerHTML + "Send message: " + text + "\n"; - input.value = ""; - dialog.receiveText(text); + document.getElementById("send").onclick = function() { + var input = document.getElementById("input"); + var text = input.value; + if (!text) { + return; } + var output = document.getElementById("output"); + output.innerHTML = output.innerHTML + "Send message: " + text + "\n"; + input.value = ""; + dialog.receiveText(text); + } - dialog.sendText.connect(function(text) { - var output = document.getElementById("output"); - output.innerHTML = output.innerHTML + "Received message: " + text + "\n"; - }); + dialog.sendText.connect(function(text) { + var output = document.getElementById("output"); + output.innerHTML = output.innerHTML + "Received message: " + text + "\n"; }); }); - - window.onload = function() { - } //END SETUP </script> <style type="text/css"> |