summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-10-23 10:34:16 +0200
committerPierre Rossi <pierre.rossi@gmail.com>2013-11-01 13:57:52 +0100
commitca2d97950e78cf7c90c36776d8234a27b458b019 (patch)
treed7d84ecd3c278855d98fa35074fce15905a14bb7
parent25c45fd2be5a0ce706af4af2fcaefc022bad8f56 (diff)
downloadqtwebchannel-ca2d97950e78cf7c90c36776d8234a27b458b019.tar.gz
Optimize: If no callback is given, send data directly without execId.
Change-Id: I47345fc52677b68ae75d018484b495fc81949054 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
-rw-r--r--src/webchannel.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/webchannel.js b/src/webchannel.js
index a8496d8..6141268 100644
--- a/src/webchannel.js
+++ b/src/webchannel.js
@@ -105,6 +105,11 @@ var QWebChannel = function(baseUrl, initCallback)
this.execId = 0;
this.exec = function(data, callback)
{
+ if (!callback) {
+ // if no callback is given, send directly
+ channel.send({data: data});
+ return;
+ }
if (channel.execId === Number.MAX_VALUE) {
// wrap
channel.execId = Number.MIN_VALUE;