Comparing version 0.1.0-alpha.7 to 0.1.0-alpha.8
@@ -23,18 +23,18 @@ /** | ||
type InitWitRetries = { | ||
type InitWithRetries = { | ||
body?: mixed; | ||
cache?: ?string; | ||
credentials?: ?string; | ||
fetchTimeout?: number; | ||
fetchTimeout?: ?number; | ||
headers?: mixed; | ||
method?: ?string; | ||
mode?: ?string; | ||
retryDelays?: Array<number>; | ||
retryDelays?: ?Array<number>; | ||
}; | ||
var DEFAULT_FETCH_TIMEOUT = 15000; | ||
var DEFAULT_RETRY_DELAYS = [1000, 3000]; | ||
var DEFAULT_TIMEOUT = 15000; | ||
var DEFAULT_RETRIES = [1000, 3000]; | ||
/** | ||
* Posts a request to the server with the given data as the payload. | ||
* Makes a POST request to the server with the given data as the payload. | ||
* Automatic retries are done based on the values in `retryDelays`. | ||
@@ -44,7 +44,7 @@ */ | ||
uri: string, | ||
initWithRetries: InitWitRetries | ||
initWithRetries?: ?InitWithRetries | ||
): Promise { | ||
var {fetchTimeout, retryDelays, ...init} = initWithRetries; | ||
var nonNullFetchTimeout = fetchTimeout || DEFAULT_FETCH_TIMEOUT; | ||
var nonNullRetryDelays = retryDelays || DEFAULT_RETRY_DELAYS; | ||
var {fetchTimeout, retryDelays, ...init} = initWithRetries || {}; | ||
var _fetchTimeout = fetchTimeout != null ? fetchTimeout : DEFAULT_TIMEOUT; | ||
var _retryDelays = retryDelays != null ? retryDelays : DEFAULT_RETRIES; | ||
@@ -75,3 +75,3 @@ var requestsAttempted = 0; | ||
} | ||
}, nonNullFetchTimeout); | ||
}, _fetchTimeout); | ||
@@ -110,3 +110,3 @@ request.then(response => { | ||
function retryRequest(): void { | ||
var retryDelay = nonNullRetryDelays[requestsAttempted - 1]; | ||
var retryDelay = _retryDelays[requestsAttempted - 1]; | ||
var retryStartTime = requestStartTime + retryDelay; | ||
@@ -123,3 +123,3 @@ // Schedule retry for a configured duration after last request started. | ||
ExecutionEnvironment.canUseDOM && | ||
attempt <= nonNullRetryDelays.length | ||
attempt <= _retryDelays.length | ||
); | ||
@@ -126,0 +126,0 @@ } |
@@ -25,18 +25,20 @@ /** | ||
var DEFAULT_FETCH_TIMEOUT = 15000; | ||
var DEFAULT_RETRY_DELAYS = [1000, 3000]; | ||
var DEFAULT_TIMEOUT = 15000; | ||
var DEFAULT_RETRIES = [1000, 3000]; | ||
/** | ||
* Posts a request to the server with the given data as the payload. | ||
* Makes a POST request to the server with the given data as the payload. | ||
* Automatic retries are done based on the values in `retryDelays`. | ||
*/ | ||
function fetchWithRetries(uri, initWithRetries) { | ||
var fetchTimeout = initWithRetries.fetchTimeout; | ||
var retryDelays = initWithRetries.retryDelays; | ||
var _ref = initWithRetries || {}; | ||
var init = _objectWithoutProperties(initWithRetries, ['fetchTimeout', 'retryDelays']); | ||
var fetchTimeout = _ref.fetchTimeout; | ||
var retryDelays = _ref.retryDelays; | ||
var nonNullFetchTimeout = fetchTimeout || DEFAULT_FETCH_TIMEOUT; | ||
var nonNullRetryDelays = retryDelays || DEFAULT_RETRY_DELAYS; | ||
var init = _objectWithoutProperties(_ref, ['fetchTimeout', 'retryDelays']); | ||
var _fetchTimeout = fetchTimeout != null ? fetchTimeout : DEFAULT_TIMEOUT; | ||
var _retryDelays = retryDelays != null ? retryDelays : DEFAULT_RETRIES; | ||
var requestsAttempted = 0; | ||
@@ -62,3 +64,3 @@ var requestStartTime = 0; | ||
} | ||
}, nonNullFetchTimeout); | ||
}, _fetchTimeout); | ||
@@ -96,3 +98,3 @@ request.then(function (response) { | ||
function retryRequest() { | ||
var retryDelay = nonNullRetryDelays[requestsAttempted - 1]; | ||
var retryDelay = _retryDelays[requestsAttempted - 1]; | ||
var retryStartTime = requestStartTime + retryDelay; | ||
@@ -107,3 +109,3 @@ // Schedule retry for a configured duration after last request started. | ||
function shouldRetry(attempt) { | ||
return ExecutionEnvironment.canUseDOM && attempt <= nonNullRetryDelays.length; | ||
return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length; | ||
} | ||
@@ -110,0 +112,0 @@ |
{ | ||
"name": "fbjs", | ||
"version": "0.1.0-alpha.7", | ||
"version": "0.1.0-alpha.8", | ||
"description": "", | ||
@@ -21,3 +21,3 @@ "main": "index.js", | ||
"gulp-util": "^3.0.4", | ||
"jest-cli": "^0.4.5", | ||
"jest-cli": "^0.5.0", | ||
"merge-stream": "^0.1.8", | ||
@@ -24,0 +24,0 @@ "object-assign": "^3.0.0", |
@@ -24,3 +24,6 @@ /** | ||
if (process.env.NODE_ENV !== 'test') { | ||
var modulePrefix = context.state.opts._modulePrefix || './'; | ||
var modulePrefix = context.state.opts._modulePrefix; | ||
if (modulePrefix == null) { | ||
modulePrefix = './'; | ||
} | ||
return modulePrefix + module; | ||
@@ -27,0 +30,0 @@ } |
require('core-js/es6'); | ||
__DEV__ = true; | ||
global.__DEV__ = true; |
@@ -5,3 +5,5 @@ var assign = require('object-assign'); | ||
var babelOpts = babelDefaultOptions; | ||
var babelOpts = assign({}, babelDefaultOptions, { | ||
retainLines: true, | ||
}); | ||
@@ -8,0 +10,0 @@ module.exports = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 20 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149139
4277
21
60