Skip to content

Commit 7621f1f

Browse files
committed
v1.1.2: Fixed import bug for Node based environment + updated polyfill sections + updated links
1 parent bb92a8c commit 7621f1f

14 files changed

+43
-19
lines changed

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ First you need to get this library, either by using [npm (w/ node)](https://node
1616

1717
Then you will need to use it in your application :
1818

19-
* \>= ES6 : `import $json from "@voltra/json"`
20-
* Node (<ES6) : `const $json = require("@voltra/json")`
19+
* \>= ES6 : `import {$json} from "@voltra/json"`
20+
* Node (<ES6) : `const {$json} = require("@voltra/json")`
2121
* In your HTML files : `<script src="your/path/to/dist/jsonclient.js"></script>` (exposes the variable `$json`)
2222

2323

@@ -52,11 +52,11 @@ Therefore, this library enables you to ease your job at emitting POST requests.
5252
$json.post :: (
5353
url: string,
5454
data: any,
55-
cache: $json.postOptions.Cache,
56-
credentials: $json.postOptions.Credentials,
57-
mode: $json.postOptions.Mode,
58-
redirect: $json.postOptions.Redirect,
59-
referrer: $json.postOptions.Referrer
55+
cache: $json.postOptionsEnums.Cache,
56+
credentials: $json.postOptionsEnums.Credentials,
57+
mode: $json.postOptionsEnums.Mode,
58+
redirect: $json.postOptionsEnums.Redirect,
59+
referrer: $json.postOptionsEnums.Referrer
6060
) -> Promise
6161
```
6262

@@ -82,8 +82,25 @@ Default values are located in the object `$json.defaults` and are classified per
8282
There are only two dependencies :
8383

8484
* [fetchJSON](https://www.npmjs.com/package/fetch_json) : Used in developpement as the GET request provider (I'm the on that needs it)
85+
8586
* The Fetch API or `fetch` : As part of the Fetch API, `fetch` allows to emit HTTP requests. This library is heavily based around this function and therefore requires it, modern browsers implement it but there are also a lot of polyfills out there, here are two of them :
87+
88+
* [fetch-ponyfill](https://www.npmjs.com/package/fetch-ponyfill) : Works for both browser and Node :
89+
90+
```javascript
91+
const {fetch, Request, Response, Headers} = require("fetch-ponyfill")();
92+
global.fetch = fetch; //For Node, this.fetch = fetch for browser
93+
94+
///OR
95+
96+
import fetchPonyfill from "fetch-ponyfill"
97+
const {fetch, Request, Response, Headers} = fetchPonyfill();
98+
```
99+
100+
101+
86102
* [whatwg-fetch](https://www.npmjs.com/package/whatwg-fetch) : For old browsers
103+
87104
* [node-fetch](https://www.npmjs.com/package/node-fetch) : For Node-based environments
88105

89106

@@ -104,7 +121,7 @@ If you don't find an answer to your problem, feel free to ask for help on my [Di
104121
>
105122
> Make sure that the version of the library you have is at least 1.1.0 (check the `package.json` file), if not update it for the latest version.
106123
>
107-
> If you're still having this problem post v1.1.0, feel free to [open an issue on GitHub]("url here boi").
124+
> If you're still having this problem post v1.1.0, feel free to [open an issue on GitHub](https://github.com/Voltra/jsonclient/issues).
108125

109126

110127

build-babel/jsonclient.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/enums/Cache.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/enums/Credentials.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/enums/Mode.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/enums/Redirect.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/enums/Referrer.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/jsonclient.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tsc/jsonclient.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jsonclient.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)