summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2019-11-01 12:47:21 +0100
committerKirill Burtsev <kirill.burtsev@qt.io>2019-11-20 10:48:56 +0100
commitcb7f660a931efacce5c149c194b63071593f1d34 (patch)
treef9e48f46f83b7be9117a52241a0928b8211ead3d
parent48ceec6ddb790730a23b5bee847bea5273300103 (diff)
downloadqtwebchannel-cb7f660a931efacce5c149c194b63071593f1d34.tar.gz
Example 'qwclient': fix lsObject() output of registered objects
Change-Id: I6b3f771eea2d92f0c3a7d05eeb13cf0b3d8b1ef4 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rwxr-xr-xexamples/webchannel/qwclient/qwclient.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/webchannel/qwclient/qwclient.js b/examples/webchannel/qwclient/qwclient.js
index 0b0909f..fa8cbf7 100755
--- a/examples/webchannel/qwclient/qwclient.js
+++ b/examples/webchannel/qwclient/qwclient.js
@@ -114,7 +114,8 @@ var setupRepl = function() {
var r = repl.start({
prompt: "webchannel> ",
input: process.stdin,
- output: process.stdout
+ output: process.stdout,
+ ignoreUndefined: true
});
r.context.serverAddress = serverAddress;
@@ -122,10 +123,15 @@ var setupRepl = function() {
r.context.channels = channels;
r.context.lsObjects = function() {
- channels.forEach(function(channel) {
- console.log('Channel ' + channel);
- Object.keys(channel.objects);
- });
+ for (let i = 0; i < channels.length; ++i) {
+ const channel = channels[i];
+ if (!channel) // closed and removed channel in repl
+ continue;
+
+ console.log('-- Channel "c' + i + '" objects:');
+ for (const obj of Object.keys(channel.objects))
+ console.log(obj, ':', channel.objects[obj]);
+ }
}
return r;
}