@@ -44,23 +44,38 @@ If you are looking for the original, it is tagged as `0.1.3`. Unless you need it
44
44
45
45
var bitcoin = require('bitcoinjs-lib')
46
46
47
- From the repo:
48
47
49
- var bitcoin = require('./src/index.js')
48
+ ### Browser
50
49
50
+ If you're familiar with how to use browserify, ignore this and proceed normally.
51
+ These steps are advisory only and allow you to use the API to its full extent.
51
52
52
- ### Browser
53
+ [ Browserify] ( https://github.com/substack/node-browserify ) is assumed to be installed for these steps.
54
+
55
+ From your repository, create a ` foobar.js ` file
56
+
57
+ ``` javascript
58
+ var foobar = {
59
+ base58: require (' bs58' ),
60
+ bitcoin: require (' bitcoinjs-lib' ),
61
+ ecurve: require (' ecurve' ),
62
+ BigInteger: require (' bigi' ),
63
+ Buffer: require (' buffer' )
64
+ }
65
+
66
+ module .exports = foobar
67
+ ```
53
68
54
- From the repository: Compile ` bitcoinjs-min.js ` with the following command:
69
+ Each of these included packages are seperate to ` bitcoinjs-lib ` , and must be installed separately.
70
+ They are however used in the bitcoinjs-lib public API.
55
71
56
- $ npm run-script compile
72
+ Using browserify, compile ` foobar.js ` for use in the browser:
57
73
58
- From NPM:
74
+ $ browserify foobar.js -s foobar > foobar.js
59
75
60
- $ npm -g install bitcoinjs-lib browserify uglify-js
61
- $ browserify -r bitcoinjs-lib -s bitcoin | uglifyjs > bitcoinjs.min.js
76
+ You will then be able to load ` foobar.js ` into your browser, with each of the dependencies above accessible from the global ` foobar ` object.
62
77
63
- After loading this file in your browser, you will be able to use the global ` bitcoin ` object .
78
+ ** NOTE ** : See our package.json for the currently supported version of browserify used by this repository .
64
79
65
80
66
81
## Examples
0 commit comments