summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/qmlapp/index.html29
-rw-r--r--examples/qmlapp/qmlapp.qml2
2 files changed, 21 insertions, 10 deletions
diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html
index e1a4bf6..2fc9715 100644
--- a/examples/qmlapp/index.html
+++ b/examples/qmlapp/index.html
@@ -2,17 +2,28 @@
<head>
<script src="../../src/qwebchannel.js"></script>
<script>
- function load() {
- navigator.webChannel.subscribe("incoming-call",
- function(message) { debug(message); }
+ window.onload = function() {
+ var textArea = document.querySelector("textarea");
+ function debug(x) {
+ textArea.value = textArea.value + x + "\n";
+ }
+
+ navigator.webChannel.subscribe(
+ "incoming-call",
+ function(message) {
+ debug(message);
+ }
);
- navigator.webChannel.exec({a:"This is a request from HTML"}, function(response) {
- debug(response.b);
- });
- }
+ navigator.webChannel.execute(
+ {a:"This is a request from HTML"},
+ function(response) {
+ debug(response.b);
+ }
+ );
+ };
</script>
</head>
- <body onload="load()">
- <div>444</div>
+ <body>
+ <textarea style="width: 100%; height: 100%"></textarea>
</body>
</html>
diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml
index 4f7aafe..b6049a6 100644
--- a/examples/qmlapp/qmlapp.qml
+++ b/examples/qmlapp/qmlapp.qml
@@ -8,7 +8,7 @@ Rectangle {
WebChannel {
id: webChannel
- onRequest: {
+ onExecute: {
var data = JSON.parse(requestData );
txt.text = data.a;
response.send(JSON.stringify({b:'This is a response from QML'}));