fetchWithRetries.js 679 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Copyright (c) 2013-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @noflow
  8. */
  9. 'use strict';
  10. var Deferred = require.requireActual('../Deferred');
  11. function fetchWithRetries() {
  12. var deferred = new Deferred();
  13. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  14. args[_key] = arguments[_key];
  15. }
  16. fetchWithRetries.mock.calls.push(args);
  17. fetchWithRetries.mock.deferreds.push(deferred);
  18. return deferred.getPromise();
  19. }
  20. fetchWithRetries.mock = {
  21. calls: [],
  22. deferreds: []
  23. };
  24. module.exports = fetchWithRetries;