From 2c68093fa28a1f56511800b2ee9ebaddb062dcf5 Mon Sep 17 00:00:00 2001 From: Alexandre GOMES Date: Mon, 14 Oct 2019 15:50:39 +0200 Subject: [PATCH] Update README.md Add up-to-date instructions on using ESModules, and fixed case from `NodeJS` to `Node.js` --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8617d5823..b0c6b6d60 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Documentation can be found [here](https://eosio.github.io/eosjs) The official distribution package can be found at [npm](https://www.npmjs.com/package/eosjs). -### NodeJS Dependency +### Add dependency to your project `yarn add eosjs` @@ -22,7 +22,7 @@ Clone this repository locally then run `yarn build-web`. The browser distributi ### ES Modules -Importing using ES6 module syntax in the browser is supported if you have a transpiler, such as Babel. +Importing using ESM syntax is supported using TypeScript, [webpack](https://webpack.js.org/api/module-methods), or [Node.js with `--experimental-modules` flag](https://nodejs.org/api/esm.html) ```js import { Api, JsonRpc, RpcError } from 'eosjs'; import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig'; // development only @@ -30,7 +30,7 @@ import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig'; // devel ### CommonJS -Importing using commonJS syntax is supported by NodeJS out of the box. +Importing using commonJS syntax is supported by Node.js out of the box. ```js const { Api, JsonRpc, RpcError } = require('eosjs'); const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); // development only @@ -54,7 +54,7 @@ const signatureProvider = new JsSignatureProvider([defaultPrivateKey]); ### JSON-RPC -Open a connection to JSON-RPC, include `fetch` when on NodeJS. +Open a connection to JSON-RPC, include `fetch` when on Node.js. ```js const rpc = new JsonRpc('http://127.0.0.1:8888', { fetch }); ```