syttunnel 0.1.5-7 → 0.1.5-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/syttunnel.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "syttunnel",
3
- "version": "0.1.5-7",
3
+ "version": "0.1.5-8",
4
4
  "description": "",
5
5
  "main": "syttunnel.js",
6
6
  "types": "index.d.ts",
package/syttunnel.js CHANGED
@@ -429,9 +429,16 @@ var Bridge = /** @class */ (function () {
429
429
  function Bridge() {
430
430
  var _this = this;
431
431
  this.onMessage = function (msg) {
432
- var message = typeof msg.data === "string"
433
- ? JSON.parse(msg.data || "")
434
- : msg.data || {};
432
+ var message = {};
433
+ if (msg.data && typeof msg.data === "string" && msg.data.length > 0) {
434
+ try {
435
+ message = JSON.parse(msg.data);
436
+ }
437
+ catch (error) { }
438
+ }
439
+ else if (msg.data) {
440
+ message = msg.data;
441
+ }
435
442
  var method = message.method;
436
443
  var value = message.value;
437
444
  var uniqueId = message.uniqueId;