summaryrefslogtreecommitdiff
path: root/src/webchannel/qwebchannel.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webchannel/qwebchannel.js')
-rw-r--r--src/webchannel/qwebchannel.js43
1 files changed, 15 insertions, 28 deletions
diff --git a/src/webchannel/qwebchannel.js b/src/webchannel/qwebchannel.js
index 472330e..c270a95 100644
--- a/src/webchannel/qwebchannel.js
+++ b/src/webchannel/qwebchannel.js
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWebChannel module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -82,9 +82,6 @@ var QWebChannel = function(transport, initCallback)
case QWebChannelMessageTypes.propertyUpdate:
channel.handlePropertyUpdate(data);
break;
- case QWebChannelMessageTypes.init:
- channel.handleInit(data);
- break;
default:
console.error("invalid message received:", message.data);
break;
@@ -149,17 +146,14 @@ var QWebChannel = function(transport, initCallback)
channel.exec({type: QWebChannelMessageTypes.idle});
}
- // prevent multiple initialization which might happen with multiple webchannel clients.
- this.initialized = false;
- this.handleInit = function(message)
+ this.debug = function(message)
{
- if (channel.initialized) {
- return;
- }
- channel.initialized = true;
- for (var objectName in message.data) {
- var data = message.data[objectName];
- var object = new QObject(objectName, data, channel);
+ channel.send({type: QWebChannelMessageTypes.debug, data: message});
+ };
+
+ channel.exec({type: QWebChannelMessageTypes.init}, function(data) {
+ for (var objectName in data) {
+ var object = new QObject(objectName, data[objectName], channel);
}
// now unwrap properties, which might reference other registered objects
for (var objectName in channel.objects) {
@@ -169,14 +163,7 @@ var QWebChannel = function(transport, initCallback)
initCallback(channel);
}
channel.exec({type: QWebChannelMessageTypes.idle});
- }
-
- this.debug = function(message)
- {
- channel.send({type: QWebChannelMessageTypes.debug, data: message});
- };
-
- channel.exec({type: QWebChannelMessageTypes.init});
+ });
};
function QObject(name, data, webChannel)