Skip to content

Commit 7f36d56

Browse files
committed
4.10.0
1 parent 1a3c56d commit 7f36d56

13 files changed

Lines changed: 117 additions & 128 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
## X.X.X (comming soon)
55

6+
## 4.10.0 (3 February 2022)
7+
68
- Improve error message when calling `postMessage` to a closed channel.
79

810
## 4.9.0 (23 December 2021)

dist/es5node/broadcast-channel.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,13 @@ function enforceOptions(options) {
115115
BroadcastChannel.prototype = {
116116
postMessage: function postMessage(msg) {
117117
if (this.closed) {
118-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
118+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
119+
/**
120+
* In the past when this error appeared, it was realy hard to debug.
121+
* So now we log the msg together with the error so it at least
122+
* gives some clue about where in your application this happens.
123+
*/
124+
JSON.stringify(msg));
119125
}
120126

121127
return _post(this, 'message', msg);

dist/esbrowser/broadcast-channel.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ export function enforceOptions(options) {
9797
BroadcastChannel.prototype = {
9898
postMessage: function postMessage(msg) {
9999
if (this.closed) {
100-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
100+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
101+
/**
102+
* In the past when this error appeared, it was realy hard to debug.
103+
* So now we log the msg together with the error so it at least
104+
* gives some clue about where in your application this happens.
105+
*/
106+
JSON.stringify(msg));
101107
}
102108

103109
return _post(this, 'message', msg);

dist/esnode/broadcast-channel.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ export function enforceOptions(options) {
9797
BroadcastChannel.prototype = {
9898
postMessage: function postMessage(msg) {
9999
if (this.closed) {
100-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
100+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
101+
/**
102+
* In the past when this error appeared, it was realy hard to debug.
103+
* So now we log the msg together with the error so it at least
104+
* gives some clue about where in your application this happens.
105+
*/
106+
JSON.stringify(msg));
101107
}
102108

103109
return _post(this, 'message', msg);

dist/lib/broadcast-channel.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,13 @@ function enforceOptions(options) {
115115
BroadcastChannel.prototype = {
116116
postMessage: function postMessage(msg) {
117117
if (this.closed) {
118-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
118+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
119+
/**
120+
* In the past when this error appeared, it was realy hard to debug.
121+
* So now we log the msg together with the error so it at least
122+
* gives some clue about where in your application this happens.
123+
*/
124+
JSON.stringify(msg));
119125
}
120126

121127
return _post(this, 'message', msg);

dist/lib/browser.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ function enforceOptions(options) {
116116
BroadcastChannel.prototype = {
117117
postMessage: function postMessage(msg) {
118118
if (this.closed) {
119-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
119+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
120+
/**
121+
* In the past when this error appeared, it was realy hard to debug.
122+
* So now we log the msg together with the error so it at least
123+
* gives some clue about where in your application this happens.
124+
*/
125+
JSON.stringify(msg));
120126
}
121127

122128
return _post(this, 'message', msg);
@@ -1686,31 +1692,19 @@ function _interopRequireDefault(obj) {
16861692
};
16871693
}
16881694

1689-
module.exports = _interopRequireDefault;
1690-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1695+
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
16911696
},{}],14:[function(require,module,exports){
16921697
function _typeof(obj) {
16931698
"@babel/helpers - typeof";
16941699

1695-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1696-
module.exports = _typeof = function _typeof(obj) {
1697-
return typeof obj;
1698-
};
1699-
1700-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1701-
} else {
1702-
module.exports = _typeof = function _typeof(obj) {
1703-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1704-
};
1705-
1706-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1707-
}
1708-
1709-
return _typeof(obj);
1700+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1701+
return typeof obj;
1702+
} : function (obj) {
1703+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1704+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
17101705
}
17111706

1712-
module.exports = _typeof;
1713-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1707+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
17141708
},{}],15:[function(require,module,exports){
17151709

17161710
},{}],16:[function(require,module,exports){

dist/lib/browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/e2e.js

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ function enforceOptions(options) {
116116
BroadcastChannel.prototype = {
117117
postMessage: function postMessage(msg) {
118118
if (this.closed) {
119-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
119+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
120+
/**
121+
* In the past when this error appeared, it was realy hard to debug.
122+
* So now we log the msg together with the error so it at least
123+
* gives some clue about where in your application this happens.
124+
*/
125+
JSON.stringify(msg));
120126
}
121127

122128
return _post(this, 'message', msg);
@@ -1751,40 +1757,27 @@ function _asyncToGenerator(fn) {
17511757
};
17521758
}
17531759

1754-
module.exports = _asyncToGenerator;
1755-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1760+
module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
17561761
},{}],15:[function(require,module,exports){
17571762
function _interopRequireDefault(obj) {
17581763
return obj && obj.__esModule ? obj : {
17591764
"default": obj
17601765
};
17611766
}
17621767

1763-
module.exports = _interopRequireDefault;
1764-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1768+
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
17651769
},{}],16:[function(require,module,exports){
17661770
function _typeof(obj) {
17671771
"@babel/helpers - typeof";
17681772

1769-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1770-
module.exports = _typeof = function _typeof(obj) {
1771-
return typeof obj;
1772-
};
1773-
1774-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1775-
} else {
1776-
module.exports = _typeof = function _typeof(obj) {
1777-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1778-
};
1779-
1780-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1781-
}
1782-
1783-
return _typeof(obj);
1773+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1774+
return typeof obj;
1775+
} : function (obj) {
1776+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1777+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
17841778
}
17851779

1786-
module.exports = _typeof;
1787-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1780+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
17881781
},{}],17:[function(require,module,exports){
17891782
module.exports = require("regenerator-runtime");
17901783

docs/iframe.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ function enforceOptions(options) {
116116
BroadcastChannel.prototype = {
117117
postMessage: function postMessage(msg) {
118118
if (this.closed) {
119-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
119+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
120+
/**
121+
* In the past when this error appeared, it was realy hard to debug.
122+
* So now we log the msg together with the error so it at least
123+
* gives some clue about where in your application this happens.
124+
*/
125+
JSON.stringify(msg));
120126
}
121127

122128
return _post(this, 'message', msg);
@@ -1721,31 +1727,19 @@ function _interopRequireDefault(obj) {
17211727
};
17221728
}
17231729

1724-
module.exports = _interopRequireDefault;
1725-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1730+
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
17261731
},{}],15:[function(require,module,exports){
17271732
function _typeof(obj) {
17281733
"@babel/helpers - typeof";
17291734

1730-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1731-
module.exports = _typeof = function _typeof(obj) {
1732-
return typeof obj;
1733-
};
1734-
1735-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1736-
} else {
1737-
module.exports = _typeof = function _typeof(obj) {
1738-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1739-
};
1740-
1741-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1742-
}
1743-
1744-
return _typeof(obj);
1735+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1736+
return typeof obj;
1737+
} : function (obj) {
1738+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1739+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
17451740
}
17461741

1747-
module.exports = _typeof;
1748-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1742+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
17491743
},{}],16:[function(require,module,exports){
17501744

17511745
},{}],17:[function(require,module,exports){

docs/index.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ function enforceOptions(options) {
116116
BroadcastChannel.prototype = {
117117
postMessage: function postMessage(msg) {
118118
if (this.closed) {
119-
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed');
119+
throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +
120+
/**
121+
* In the past when this error appeared, it was realy hard to debug.
122+
* So now we log the msg together with the error so it at least
123+
* gives some clue about where in your application this happens.
124+
*/
125+
JSON.stringify(msg));
120126
}
121127

122128
return _post(this, 'message', msg);
@@ -1721,31 +1727,19 @@ function _interopRequireDefault(obj) {
17211727
};
17221728
}
17231729

1724-
module.exports = _interopRequireDefault;
1725-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1730+
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
17261731
},{}],15:[function(require,module,exports){
17271732
function _typeof(obj) {
17281733
"@babel/helpers - typeof";
17291734

1730-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1731-
module.exports = _typeof = function _typeof(obj) {
1732-
return typeof obj;
1733-
};
1734-
1735-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1736-
} else {
1737-
module.exports = _typeof = function _typeof(obj) {
1738-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1739-
};
1740-
1741-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1742-
}
1743-
1744-
return _typeof(obj);
1735+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1736+
return typeof obj;
1737+
} : function (obj) {
1738+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1739+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
17451740
}
17461741

1747-
module.exports = _typeof;
1748-
module.exports["default"] = module.exports, module.exports.__esModule = true;
1742+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
17491743
},{}],16:[function(require,module,exports){
17501744

17511745
},{}],17:[function(require,module,exports){

0 commit comments

Comments
 (0)