diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2013-10-23 10:34:16 +0200 |
---|---|---|
committer | Pierre Rossi <pierre.rossi@gmail.com> | 2013-11-01 13:57:52 +0100 |
commit | ca2d97950e78cf7c90c36776d8234a27b458b019 (patch) | |
tree | d7d84ecd3c278855d98fa35074fce15905a14bb7 /src | |
parent | 25c45fd2be5a0ce706af4af2fcaefc022bad8f56 (diff) | |
download | qtwebchannel-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>
Diffstat (limited to 'src')
-rw-r--r-- | src/webchannel.js | 5 |
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; |