Skip to content

Commit 72883d9

Browse files
committed
0.6.0
1 parent 2460912 commit 72883d9

9 files changed

+102
-14
lines changed

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tag-version-prefix=""

dist/webduino-all.js

+31-2
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ Paho.MQTT = (function (global) {
24962496
})(window);
24972497

24982498
var webduino = webduino || {
2499-
version: '0.5.4'
2499+
version: '0.6.0'
25002500
};
25012501

25022502
if (typeof exports !== 'undefined') {
@@ -4118,6 +4118,8 @@ if (typeof exports !== 'undefined') {
41184118
this._transport = null;
41194119
this._pinStateEventCenter = new EventEmitter();
41204120
this._logger = new Logger('Board');
4121+
this._sendingInterval = 0;
4122+
this._sendingRec = [];
41214123

41224124
this._initialVersionResultHandler = onInitialVersionResult.bind(this);
41234125
this._openHandler = onOpen.bind(this);
@@ -4233,6 +4235,16 @@ if (typeof exports !== 'undefined') {
42334235
}
42344236
},
42354237

4238+
sendingInterval: {
4239+
get: function () {
4240+
return this._sendingInterval;
4241+
},
4242+
set: function (interval) {
4243+
if (typeof interval !== 'number') return;
4244+
this._sendingInterval = interval < 0 ? 0: interval;
4245+
}
4246+
},
4247+
42364248
isReady: {
42374249
get: function () {
42384250
return this._isReady;
@@ -4887,7 +4899,24 @@ if (typeof exports !== 'undefined') {
48874899
};
48884900

48894901
proto.send = function (data) {
4890-
this.isConnected && this._transport.send(data);
4902+
if (!this.isConnected) return;
4903+
if (this.sendingInterval === 0) {
4904+
this._transport.send(data);
4905+
return;
4906+
}
4907+
4908+
var idx = this._sendingRec.findIndex(function (val) {
4909+
return val.value.toString() === data.toString();
4910+
});
4911+
if (idx !== -1) {
4912+
if (Date.now() - this._sendingRec[idx].timestamp < this.sendingInterval) return;
4913+
this._sendingRec.splice(idx, 1);
4914+
}
4915+
this._sendingRec.push({
4916+
value: data.slice(),
4917+
timestamp: Date.now()
4918+
});
4919+
this._transport.send(data);
48914920
};
48924921

48934922
proto.close = function (callback) {

dist/webduino-all.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/webduino-base.js

+31-2
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ Paho.MQTT = (function (global) {
24962496
})(window);
24972497

24982498
var webduino = webduino || {
2499-
version: '0.5.4'
2499+
version: '0.6.0'
25002500
};
25012501

25022502
if (typeof exports !== 'undefined') {
@@ -4118,6 +4118,8 @@ if (typeof exports !== 'undefined') {
41184118
this._transport = null;
41194119
this._pinStateEventCenter = new EventEmitter();
41204120
this._logger = new Logger('Board');
4121+
this._sendingInterval = 0;
4122+
this._sendingRec = [];
41214123

41224124
this._initialVersionResultHandler = onInitialVersionResult.bind(this);
41234125
this._openHandler = onOpen.bind(this);
@@ -4233,6 +4235,16 @@ if (typeof exports !== 'undefined') {
42334235
}
42344236
},
42354237

4238+
sendingInterval: {
4239+
get: function () {
4240+
return this._sendingInterval;
4241+
},
4242+
set: function (interval) {
4243+
if (typeof interval !== 'number') return;
4244+
this._sendingInterval = interval < 0 ? 0: interval;
4245+
}
4246+
},
4247+
42364248
isReady: {
42374249
get: function () {
42384250
return this._isReady;
@@ -4887,7 +4899,24 @@ if (typeof exports !== 'undefined') {
48874899
};
48884900

48894901
proto.send = function (data) {
4890-
this.isConnected && this._transport.send(data);
4902+
if (!this.isConnected) return;
4903+
if (this.sendingInterval === 0) {
4904+
this._transport.send(data);
4905+
return;
4906+
}
4907+
4908+
var idx = this._sendingRec.findIndex(function (val) {
4909+
return val.value.toString() === data.toString();
4910+
});
4911+
if (idx !== -1) {
4912+
if (Date.now() - this._sendingRec[idx].timestamp < this.sendingInterval) return;
4913+
this._sendingRec.splice(idx, 1);
4914+
}
4915+
this._sendingRec.push({
4916+
value: data.slice(),
4917+
timestamp: Date.now()
4918+
});
4919+
this._transport.send(data);
48914920
};
48924921

48934922
proto.close = function (callback) {

dist/webduino-base.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/files/src_core_Board.js.html

+30-1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ <h1>src/core/Board.js <small>File</small></h1>
194194
this._transport = null;
195195
this._pinStateEventCenter = new EventEmitter();
196196
this._logger = new Logger(&#x27;Board&#x27;);
197+
this._sendingInterval = 0;
198+
this._sendingRec = [];
197199

198200
this._initialVersionResultHandler = onInitialVersionResult.bind(this);
199201
this._openHandler = onOpen.bind(this);
@@ -309,6 +311,16 @@ <h1>src/core/Board.js <small>File</small></h1>
309311
}
310312
},
311313

314+
sendingInterval: {
315+
get: function () {
316+
return this._sendingInterval;
317+
},
318+
set: function (interval) {
319+
if (typeof interval !== &#x27;number&#x27;) return;
320+
this._sendingInterval = interval &lt; 0 ? 0: interval;
321+
}
322+
},
323+
312324
isReady: {
313325
get: function () {
314326
return this._isReady;
@@ -963,7 +975,24 @@ <h1>src/core/Board.js <small>File</small></h1>
963975
};
964976

965977
proto.send = function (data) {
966-
this.isConnected &amp;&amp; this._transport.send(data);
978+
if (!this.isConnected) return;
979+
if (this.sendingInterval === 0) {
980+
this._transport.send(data);
981+
return;
982+
}
983+
984+
var idx = this._sendingRec.findIndex(function (val) {
985+
return val.value.toString() === data.toString();
986+
});
987+
if (idx !== -1) {
988+
if (Date.now() - this._sendingRec[idx].timestamp &lt; this.sendingInterval) return;
989+
this._sendingRec.splice(idx, 1);
990+
}
991+
this._sendingRec.push({
992+
value: data.slice(),
993+
timestamp: Date.now()
994+
});
995+
this._transport.send(data);
967996
};
968997

969998
proto.close = function (callback) {

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webduino-js",
3-
"version": "0.5.4",
3+
"version": "0.6.0",
44
"main": "index.js",
55
"description": "The Webduino Javascript Core, for Browser and Node.js",
66
"repository": "https://github.com/webduinoio/webduino-js.git",

src/webduino.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var webduino = webduino || {
2-
version: '0.5.4'
2+
version: '0.6.0'
33
};
44

55
if (typeof exports !== 'undefined') {

0 commit comments

Comments
 (0)