@@ -52,16 +52,33 @@ From the repo:
52
52
53
53
### Browser
54
54
55
- From the repository: Compile ` bitcoinjs-min.js ` with the following command:
55
+ If your are familiar with how to use browserify, ignore this and proceed normally.
56
+ These steps are advisory only and allow you to use the ` bitcoinjs-lib ` to its full extent.
56
57
57
- $ npm run-script compile
58
+ [ Browserify ] ( https://github.com/substack/node-browserify ) is assumed to be installed for these steps.
58
59
59
- From NPM:
60
60
61
- $ npm -g install bitcoinjs-lib browserify uglify-js
62
- $ browserify -r bitcoinjs-lib -s bitcoin | uglifyjs > bitcoinjs.min.js
61
+ From your repository, create a ` bitcoin.js ` file
63
62
64
- After loading this file in your browser, you will be able to use the global ` bitcoin ` object.
63
+ ``` javascript
64
+ var bitcoin = {
65
+ base58: require (' bs58' ),
66
+ ecurve: require (' ecurve' ),
67
+ BigInteger: require (' bigi' ),
68
+ Buffer: require (' buffer' )
69
+ }
70
+
71
+ var bitcoinjs = require (' bitcoinjs-lib' )
72
+ for (var a in bitcoinjs) bitcoin[a] = bitcoinjs[a]
73
+
74
+ module .exports = bitcoin
75
+ ```
76
+
77
+ Then, using browserify, compile ` bitcoin.js ` for use in the browser:
78
+
79
+ $ browserify bitcoin.js -s bitcoin > dist/bitcoin.js
80
+
81
+ You will then be able to load ` dist/bitcoin.js ` into your browser, with each of the dependencies above accessible from the global ` bitcoin ` object.
65
82
66
83
67
84
## Usage
0 commit comments