fetch.js 517 B

1234567891011121314151617181920212223242526
  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 fetch(uri, options) {
  12. var deferred = new Deferred();
  13. fetch.mock.calls.push([uri, options]);
  14. fetch.mock.deferreds.push(deferred);
  15. return deferred.getPromise();
  16. }
  17. fetch.mock = {
  18. calls: [],
  19. deferreds: []
  20. };
  21. module.exports = fetch;