# ember-network

> Universal fetch() polyfill (FastBoot and browser) for Ember apps

Latest version **0.3.1** (published 2016-12-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ember-network
pnpm add ember-network
yarn add ember-network
bun add ember-network
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2016-12-07 |
| First published | 2016-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 113 |
| Maintainers | locks, tomdale |
| Keywords | ember-addon, fetch |

## Links

- npm: https://www.npmjs.com/package/ember-network
- Repository: https://github.com/tomdale/ember-network
- Homepage: https://github.com/tomdale/ember-network#readme
- Issues: https://github.com/tomdale/ember-network/issues
- npm.io page: https://npm.io/package/ember-network

## Dependencies (7)

- [node-fetch](https://npm.io/package/node-fetch.md) ^1.3.3
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) ^0.11.0
- [broccoli-stew](https://npm.io/package/broccoli-stew.md) ^1.0.4
- [broccoli-funnel](https://npm.io/package/broccoli-funnel.md) ^1.0.1
- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^5.1.5
- [broccoli-templater](https://npm.io/package/broccoli-templater.md) ^1.0.0
- [broccoli-merge-trees](https://npm.io/package/broccoli-merge-trees.md) ^1.0.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.3.1 (latest) — 2016-12-07
- 0.3.0 — 2016-04-06
- 0.2.0 — 2016-01-19
- 0.1.0 — 2016-01-12

## README

# ember-network

Ember Network provides low-level networking primitives that work both in
the browser and in Node.js via [FastBoot][fastboot].

[fastboot]: https://github.com/tildeio/ember-cli-fastboot

## Installation

In your Ember app or addon, run:

* `ember install ember-network`

## Usage

Currently, Ember Network implements the [WHATWG Fetch][whatwg-fetch]
standard. Other standards may be implemented in the future.

[whatwg-fetch]: https://fetch.spec.whatwg.org

### Fetch

```js
import Route from "ember-route";
import fetch from "ember-network/fetch";

export default Route.extend({
  model() {
    return fetch('https://api.github.com/users/tomdale/events')
      .then(function(response) {
        return response.json();
      });
  }
});
```

For more information on using `fetch()`, see:

* [Jake Archibald's poppycock](https://jakearchibald.com/2015/thats-so-fetch/)
* [MDN Fetch guide](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)
* [WHATWG Fetch specification][whatwg-fetch]

To see a very simple example app using FastBoot and Ember Network, see:

* [github-fastboot-example](https://github.com/tomdale/github-fastboot-example)

## How It Works

At build time, Ember Network detects if the build target is FastBoot or
the browser. For FastBoot, it swaps in the [node-fetch][node-fetch]
library. For the browser, it swaps in [GitHub's fetch
polyfill][github-fetch]. (The browser polyfill will use the native
`window.fetch()` if available.) The appropriate version will appear in
your `vendor.js` file.

[node-fetch]: https://www.npmjs.com/package/node-fetch
[github-fetch]: https://github.com/github/fetch

If you'd like to write an Ember addon that does something similar,
[please see the annotated index.js file](index.js).

---
_Source: https://npm.io/package/ember-network · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
