Skip to content

Commit

Permalink
Remove URL
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Aug 25, 2020
1 parent 34e7c0e commit f730f6b
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions docs/api-reference-1/frontity.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ You can read more in the [Code Splitting](../learning-frontity/code-splitting.md

* [loadable](frontity.md#loadable)

### `fetch` and `URL`
### `fetch`

Frontity exports `fetch` and `URL` with the same API they have in the browser, but they work the same both in the client and in the server.
Frontity exports `fetch` with the same API it has in the browser, but it works the same both in the client and in the server.

#### **API reference:**

* [fetch](frontity.md#fetch)
* [URL](frontity.md#url)

### Helpers

Expand Down Expand Up @@ -577,41 +576,6 @@ const getFromSomeAPI = async (resource) => {
};
```
### `URL`
#### Syntax
```javascript
const url = new URL(url, base);
```
It's a constructor with the [WHATWG API](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) to create [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) objects.
This constructor is safe to use both server and client side, but you have to import it first.
#### Arguments
* **`url`**: a string representing an absolute or relative URL
If `url` is a relative URL, `base` is required
* **`base`**: a string representing the base URL to use in case `url` is a relative URL
#### Return value
* A [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL)object
#### Example
```jsx
import { URL } from "frontity";

const getApiPathname = ({ state }) => {
const { pathname } = new URL(state.source.api);
return pathname;
};
```
### `decode`
An entity decoder that decodes HTML numeric entities and [XML named entities](https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references). It works both in the server and the client and it's optimized to be both lightweight and performant.
Expand Down

0 comments on commit f730f6b

Please sign in to comment.