Update docs

This commit is contained in:
Miguel Mota 2023-04-24 00:23:21 -07:00
parent 6c7fa932c8
commit 905a95c358
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9
2 changed files with 18 additions and 4 deletions

View File

@ -43,6 +43,18 @@ From [NPM](https://www.npmjs.com/package/merkletreejs):
npm install merkletreejs npm install merkletreejs
``` ```
Import as ES6 module
```js
import { MerkleTree } from 'merkletreejs'
```
Import as CommonJs
```js
const { MerkleTree } = require('merkletreejs')
```
### CDN ### CDN
Available on [jsDelivr](https://www.jsdelivr.com/) CDN: Available on [jsDelivr](https://www.jsdelivr.com/) CDN:
@ -51,6 +63,8 @@ Available on [jsDelivr](https://www.jsdelivr.com/) CDN:
<script src="https://cdn.jsdelivr.net/npm/merkletreejs@latest/merkletree.js"></script> <script src="https://cdn.jsdelivr.net/npm/merkletreejs@latest/merkletree.js"></script>
``` ```
The exported classes will be available on `window` object, e.g. `window.MerkleTree`
## Example ## Example
[https://lab.miguelmota.com/merkletreejs](https://lab.miguelmota.com/merkletreejs) [https://lab.miguelmota.com/merkletreejs](https://lab.miguelmota.com/merkletreejs)

View File

@ -349,7 +349,7 @@ ___
### getHexLayers ### getHexLayers
**getHexLayers**(): *string[]* **getHexLayers**(): *string[][]*
getHexLayers getHexLayers
@ -360,7 +360,7 @@ getHexLayers
const layers = tree.getHexLayers() const layers = tree.getHexLayers()
``` ```
**Returns:** *string[]* **Returns:** *string[][]*
___ ___
@ -506,7 +506,7 @@ ___
### getLayers ### getLayers
**getLayers**(): *Buffer[]* **getLayers**(): *Buffer[][]*
getLayers getLayers
@ -517,7 +517,7 @@ getLayers
const layers = tree.getLayers() const layers = tree.getLayers()
``` ```
**Returns:** *Buffer[]* **Returns:** *Buffer[][]*
___ ___