recompile js bundles from master (#736)

This commit is contained in:
Flavio Curella 2017-09-13 10:32:40 -07:00 committed by Andrew Godwin
parent 2d4886dfa0
commit 65150d16a7
2 changed files with 21 additions and 8 deletions

View File

@ -3,6 +3,9 @@
*/ */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.channels = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.channels = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict"; "use strict";
;
;
;
var isWebSocket = function (constructor) { var isWebSocket = function (constructor) {
return constructor && constructor.CLOSING === 2; return constructor && constructor.CLOSING === 2;
}; };
@ -44,7 +47,9 @@ var reassignEventListeners = function (ws, oldWs, listeners) {
}); });
}); });
if (oldWs) { if (oldWs) {
LEVEL_0_EVENTS.forEach(function (name) { ws[name] = oldWs[name]; }); LEVEL_0_EVENTS.forEach(function (name) {
ws[name] = oldWs[name];
});
} }
}; };
var ReconnectingWebsocket = function (url, protocols, options) { var ReconnectingWebsocket = function (url, protocols, options) {
@ -72,7 +77,7 @@ var ReconnectingWebsocket = function (url, protocols, options) {
var log = config.debug ? function () { var log = config.debug ? function () {
var params = []; var params = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
params[_i - 0] = arguments[_i]; params[_i] = arguments[_i];
} }
return console.log.apply(console, ['RWS:'].concat(params)); return console.log.apply(console, ['RWS:'].concat(params));
} : function () { }; } : function () { };
@ -94,7 +99,7 @@ var ReconnectingWebsocket = function (url, protocols, options) {
} }
}, 0); }; }, 0); };
var handleClose = function () { var handleClose = function () {
log('close'); log('handleClose', { shouldRetry: shouldRetry });
retriesCount++; retriesCount++;
log('retries count:', retriesCount); log('retries count:', retriesCount);
if (retriesCount > config.maxRetries) { if (retriesCount > config.maxRetries) {
@ -107,15 +112,19 @@ var ReconnectingWebsocket = function (url, protocols, options) {
else { else {
reconnectDelay = updateReconnectionDelay(config, reconnectDelay); reconnectDelay = updateReconnectionDelay(config, reconnectDelay);
} }
log('reconnectDelay:', reconnectDelay); log('handleClose - reconnectDelay:', reconnectDelay);
if (shouldRetry) { if (shouldRetry) {
setTimeout(connect, reconnectDelay); setTimeout(connect, reconnectDelay);
} }
}; };
var connect = function () { var connect = function () {
if (!shouldRetry) {
return;
}
log('connect'); log('connect');
var oldWs = ws; var oldWs = ws;
ws = new config.constructor(url, protocols); var wsUrl = (typeof url === 'function') ? url() : url;
ws = new config.constructor(wsUrl, protocols);
connectingTimeout = setTimeout(function () { connectingTimeout = setTimeout(function () {
log('timeout'); log('timeout');
ws.close(); ws.close();
@ -147,10 +156,11 @@ var ReconnectingWebsocket = function (url, protocols, options) {
if (code === void 0) { code = 1000; } if (code === void 0) { code = 1000; }
if (reason === void 0) { reason = ''; } if (reason === void 0) { reason = ''; }
var _b = _a === void 0 ? {} : _a, _c = _b.keepClosed, keepClosed = _c === void 0 ? false : _c, _d = _b.fastClose, fastClose = _d === void 0 ? true : _d, _e = _b.delay, delay = _e === void 0 ? 0 : _e; var _b = _a === void 0 ? {} : _a, _c = _b.keepClosed, keepClosed = _c === void 0 ? false : _c, _d = _b.fastClose, fastClose = _d === void 0 ? true : _d, _e = _b.delay, delay = _e === void 0 ? 0 : _e;
log('close - params:', { reason: reason, keepClosed: keepClosed, fastClose: fastClose, delay: delay, retriesCount: retriesCount, maxRetries: config.maxRetries });
shouldRetry = !keepClosed && retriesCount <= config.maxRetries;
if (delay) { if (delay) {
reconnectDelay = delay; reconnectDelay = delay;
} }
shouldRetry = !keepClosed;
ws.close(code, reason); ws.close(code, reason);
if (fastClose) { if (fastClose) {
var fakeCloseEvent_1 = { var fakeCloseEvent_1 = {
@ -205,6 +215,7 @@ var ReconnectingWebsocket = function (url, protocols, options) {
} }
ws.removeEventListener(type, listener, options); ws.removeEventListener(type, listener, options);
}; };
return this;
}; };
module.exports = ReconnectingWebsocket; module.exports = ReconnectingWebsocket;
@ -259,7 +270,7 @@ var WebSocketBridge = function () {
* @param {String} [url] The url of the websocket. Defaults to * @param {String} [url] The url of the websocket. Defaults to
* `window.location.host` * `window.location.host`
* @param {String[]|String} [protocols] Optional string or array of protocols. * @param {String[]|String} [protocols] Optional string or array of protocols.
* @param {Object} options Object of options for [`reconnecting-websocket`](https://github.com/joewalnes/reconnecting-websocket#options-1). * @param {Object} options Object of options for [`reconnecting-websocket`](https://github.com/pladaria/reconnecting-websocket#configure).
* @example * @example
* const webSocketBridge = new WebSocketBridge(); * const webSocketBridge = new WebSocketBridge();
* webSocketBridge.connect(); * webSocketBridge.connect();

View File

@ -48,7 +48,7 @@ var WebSocketBridge = function () {
* @param {String} [url] The url of the websocket. Defaults to * @param {String} [url] The url of the websocket. Defaults to
* `window.location.host` * `window.location.host`
* @param {String[]|String} [protocols] Optional string or array of protocols. * @param {String[]|String} [protocols] Optional string or array of protocols.
* @param {Object} options Object of options for [`reconnecting-websocket`](https://github.com/joewalnes/reconnecting-websocket#options-1). * @param {Object} options Object of options for [`reconnecting-websocket`](https://github.com/pladaria/reconnecting-websocket#configure).
* @example * @example
* const webSocketBridge = new WebSocketBridge(); * const webSocketBridge = new WebSocketBridge();
* webSocketBridge.connect(); * webSocketBridge.connect();
@ -72,6 +72,8 @@ var WebSocketBridge = function () {
_url = url; _url = url;
} }
} }
// Some mobile devices (eg: HTC M8, SAMSUNG Galaxy S8) will get error code
// [1006] during handshake if `protocols` is `undefined`.
var _protocols = protocols === undefined ? '' : protocols; var _protocols = protocols === undefined ? '' : protocols;
this.socket = new _reconnectingWebsocket2.default(_url, _protocols, options); this.socket = new _reconnectingWebsocket2.default(_url, _protocols, options);
} }