Docs: Require Node 6.9.0, update boilerplate to avoid destructuring assign

This commit is contained in:
mDuo13
2017-05-09 15:51:45 -07:00
parent de47263087
commit 469fefee92
3 changed files with 16 additions and 30 deletions

View File

@@ -93,7 +93,7 @@ RippleAPI only provides access to *validated*, *immutable* transaction data.
Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI. Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI.
```javascript ```javascript
const {RippleAPI} = require('ripple-lib'); const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({ const api = new RippleAPI({
server: 'wss://s1.ripple.com' // Public rippled server hosted by Ripple, Inc. server: 'wss://s1.ripple.com' // Public rippled server hosted by Ripple, Inc.
@@ -116,9 +116,9 @@ api.connect().then(() => {
}).catch(console.error); }).catch(console.error);
``` ```
RippleAPI is designed to work in [NodeJS](https://nodejs.org) (version `0.12.0` or greater) using [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support. RippleAPI is designed to work in [Node.js](https://nodejs.org) version **6.9.0** or later. RippleAPI may work on older Node.js versions if you use [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support.
The code samples in this documentation are written in ES6, but `RippleAPI` will work with ES5 also. Regardless of whether you use ES5 or ES6, the methods that return promises will return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). The code samples in this documentation are written with ECMAScript 6 (ES6) features, but `RippleAPI` also works with ECMAScript 5 (ES5). Regardless of whether you use ES5 or ES6, the methods that return Promises return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
<aside class="notice"> <aside class="notice">
All the code snippets in this documentation assume that you have surrounded them with this boilerplate. All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
@@ -155,19 +155,13 @@ If you omit the `server` parameter, RippleAPI operates [offline](#offline-functi
### Installation ### ### Installation ###
1. Install [NodeJS](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for NodeJS, but make sure you have version `0.12.0` or higher. 1. Install [Node.js](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for Node.js, but make sure you have version **6.9.0** or higher.
2. Use npm to install [Babel](https://babeljs.io/) globally: 2. Use npm to install RippleAPI:
`npm install -g babel-cli`
3. Use npm to install RippleAPI:
`npm install ripple-lib` `npm install ripple-lib`
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using babel-node: After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using the Node.js executable, typically named `node`:
`babel-node script.js`
<aside class="notice">
Instead of using babel-node in production, we recommend using Babel to transpile to ECMAScript 5 first.
</aside>
`node script.js`
## Offline functionality ## Offline functionality
@@ -176,7 +170,7 @@ RippleAPI can also function without internet connectivity. This can be useful in
To instantiate RippleAPI in offline mode, use the following boilerplate code: To instantiate RippleAPI in offline mode, use the following boilerplate code:
```javascript ```javascript
const {RippleAPI} = require('ripple-lib'); const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI(); const api = new RippleAPI();
/* insert code here */ /* insert code here */
@@ -196,7 +190,6 @@ Methods that depend on the state of the Ripple Consensus Ledger are unavailable
* [generateAddress](#generateaddress) * [generateAddress](#generateaddress)
* [computeLedgerHash](#computeledgerhash) * [computeLedgerHash](#computeledgerhash)
# Basic Types # Basic Types
## Ripple Address ## Ripple Address

View File

@@ -3,7 +3,7 @@
Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI. Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI.
```javascript ```javascript
const {RippleAPI} = require('ripple-lib'); const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({ const api = new RippleAPI({
server: 'wss://s1.ripple.com' // Public rippled server hosted by Ripple, Inc. server: 'wss://s1.ripple.com' // Public rippled server hosted by Ripple, Inc.
@@ -26,9 +26,9 @@ api.connect().then(() => {
}).catch(console.error); }).catch(console.error);
``` ```
RippleAPI is designed to work in [NodeJS](https://nodejs.org) (version `0.12.0` or greater) using [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support. RippleAPI is designed to work in [Node.js](https://nodejs.org) version **6.9.0** or later. RippleAPI may work on older Node.js versions if you use [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support.
The code samples in this documentation are written in ES6, but `RippleAPI` will work with ES5 also. Regardless of whether you use ES5 or ES6, the methods that return promises will return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). The code samples in this documentation are written with ECMAScript 6 (ES6) features, but `RippleAPI` also works with ECMAScript 5 (ES5). Regardless of whether you use ES5 or ES6, the methods that return Promises return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
<aside class="notice"> <aside class="notice">
All the code snippets in this documentation assume that you have surrounded them with this boilerplate. All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
@@ -53,16 +53,10 @@ If you omit the `server` parameter, RippleAPI operates [offline](#offline-functi
### Installation ### ### Installation ###
1. Install [NodeJS](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for NodeJS, but make sure you have version `0.12.0` or higher. 1. Install [Node.js](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for Node.js, but make sure you have version **6.9.0** or higher.
2. Use npm to install [Babel](https://babeljs.io/) globally: 2. Use npm to install RippleAPI:
`npm install -g babel-cli`
3. Use npm to install RippleAPI:
`npm install ripple-lib` `npm install ripple-lib`
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using babel-node: After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using the Node.js executable, typically named `node`:
`babel-node script.js`
<aside class="notice">
Instead of using babel-node in production, we recommend using Babel to transpile to ECMAScript 5 first.
</aside>
`node script.js`

View File

@@ -5,7 +5,7 @@ RippleAPI can also function without internet connectivity. This can be useful in
To instantiate RippleAPI in offline mode, use the following boilerplate code: To instantiate RippleAPI in offline mode, use the following boilerplate code:
```javascript ```javascript
const {RippleAPI} = require('ripple-lib'); const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI(); const api = new RippleAPI();
/* insert code here */ /* insert code here */
@@ -24,4 +24,3 @@ Methods that depend on the state of the Ripple Consensus Ledger are unavailable
* [sign](#sign) * [sign](#sign)
* [generateAddress](#generateaddress) * [generateAddress](#generateaddress)
* [computeLedgerHash](#computeledgerhash) * [computeLedgerHash](#computeledgerhash)