Skip to content

Commit a9434f7

Browse files
committed
README: add notes about ES5, Node LTS feature tracking
1 parent d364e65 commit a9434f7

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,41 @@ var bitcoin = require('bitcoinjs-lib')
4141

4242
### Browser
4343
If you're familiar with how to use browserify, ignore this and proceed normally.
44-
These steps are advisory only, and may not be necessary for your application.
44+
These steps are advisory only, and may not be suitable for your application.
4545

4646
[Browserify](https://github.com/substack/node-browserify) is assumed to be installed for these steps.
4747

48-
From your repository, create an `index.js` file
48+
For your project, create an `index.js` file
4949
``` javascript
50-
module.exports = {
51-
base58: require('bs58'),
52-
bitcoin: require('bitcoinjs-lib'),
53-
ecurve: require('ecurve'),
54-
BigInteger: require('bigi')
50+
let bitcoin = require('bitcoinjs-lib')
51+
52+
// your code here
53+
function myFunction () {
54+
return bitcoin.ECPair.makeRandom().toWIF()
5555
}
56-
```
5756

58-
Install each of the above packages locally
59-
``` bash
60-
npm install bs58 bitcoinjs-lib ecurve bigi
57+
module.exports = {
58+
myFunction
59+
}
6160
```
6261

63-
After installation, use browserify to compile `index.js` for use in the browser:
62+
Now, to compile for the browser:
6463
``` bash
65-
$ browserify index.js --standalone foo > app.js
64+
browserify index.js --standalone foo > app.js
6665
```
6766

68-
You will now be able to use `<script src="app.js" />` in your browser, with each of the above exports accessible via the global `foo` object (or whatever you chose for the `--standalone` parameter above).
69-
70-
**NOTE**: See our package.json for the currently supported version of browserify used by this repository.
67+
You can now put `<script src="app.js" />` in your web page, using `foo.myFunction` to create a new Bitcoin private key.
7168

72-
**NOTE**: When uglifying the javascript, you must exclude the following variable names from being mangled: `Array`, `BigInteger`, `Boolean`, `ECPair`, `Function`, `Number`, `Point` and `Script`.
69+
**NOTE**: If you uglify the javascript, you must exclude the following variable names from being mangled: `BigInteger`, `ECPair`, `Point`.
7370
This is because of the function-name-duck-typing used in [typeforce](https://github.com/dcousens/typeforce).
71+
7472
Example:
7573
``` bash
76-
uglifyjs ... --mangle --reserved 'Array,BigInteger,Boolean,ECPair,Function,Number,Point'
74+
uglifyjs ... --mangle --reserved 'BigInteger,ECPair,Point'
7775
```
7876

77+
**NOTE**: This library tracks Node LTS features, if you need strict ES5, use [`--transform babelify`](https://github.com/babel/babelify) in conjunction with your `browserify` step (using an [`es2015`](http://babeljs.io/docs/plugins/preset-es2015/) preset).
78+
7979
**NOTE**: If you expect this library to run on an iOS 10 device, ensure that you are using [[email protected]](https://github.com/feross/buffer/pull/155) or greater.
8080

8181

@@ -85,7 +85,7 @@ Type declarations for Typescript are available for version `^3.0.0` of the libra
8585
npm install @types/bitcoinjs-lib
8686
```
8787

88-
You can now use `bitcoinjs-lib` as a typescript compliant library.
88+
You can now use `bitcoinjs-lib` as a typescript compliant library.
8989
``` javascript
9090
import { HDNode, Transaction } from 'bitcoinjs-lib'
9191
```

0 commit comments

Comments
 (0)