UNPKG

1.99 kBMarkdownView Raw
1# [Loom.js](https://loomx.io) [![Build Status](https://travis-ci.org/loomnetwork/loom-js.svg?branch=master)](https://travis-ci.org/loomnetwork/loom-js)
2
3JS library for building browser apps & NodeJS services that interact with Loom DAppChains.
4
5## Install
6
7### NodeJS
8
9```
10# NPM
11npm install loom-js
12# Yarn
13yarn add loom-js
14```
15
16### Browser
17
18```html
19<script src="https://cdn.jsdelivr.net/npm/loom-js@1.13.0/dist/loom.umd.js"></script>
20```
21
22## Development
23
24```shell
25# build for Node
26yarn build
27# build for Browser
28yarn build:browser
29# build for Node while targeting ES2017 (more readable than ES5)
30yarn build:dev
31# run unit tests on Node & Browser
32yarn test
33# auto-format source files
34yarn format
35# run unit tests in Node
36yarn test:node
37# run unit tests in Electon
38yarn test:browser
39# run e2e test in Node (local DAppChain node must be running first)
40yarn e2e:node
41# run e2e test in Electron (local DAppChain node must be running first)
42yarn e2e:browser
43```
44
45The e2e test environment can be configured by changing `.env.test` (see `.env.test.example` for
46default values).
47
48### Debugging
49
50To debug loom-js while using it another project:
511. Clone the Git repo from https://github.com/loomnetwork/loom-js
522. Inside the loom-js repo run:
53 ```bash
54 yarn link
55 yarn build:dev
56 ```
573. In your project repo run `yarn link loom-js`.
584. Debug your project normally.
59
60`yarn build:dev` will compile the TypeScript source to target ES2017, which requires a lot less
61transformation of async/await constructs than the ES5 code released on NPM.
62
63### Regenerating Protobufs
64
65Whenever you change `src/proto/loom.proto`, or `src/tests/tests.proto` you will need to regenerate
66the corresponding `*_pb.js` by running:
67
68```shell
69yarn proto
70```
71
72The shell must be able to locate the `protoc` binary, which can be obtained from https://github.com/google/protobuf/releases
73
74## License
75
76BSD 3-Clause, see `LICENSE` file for details.