JS library for building browser apps & NodeJS services that interact with Loom DAppChains.
# NPM
npm install loom-js
# Yarn
yarn add loom-js
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/loom.umd.js"></script>
# build for Node
yarn build
# build for Browser
yarn build:browser
# build for Node while targeting ES2017 (more readable than ES5)
yarn build:dev
# run unit tests on Node & Browser
yarn test
# auto-format source files
yarn format
# run unit tests in Node
yarn test:node
# run unit tests in Electon
yarn test:browser
# run e2e test in Node (local DAppChain node must be running first)
yarn e2e:node
# run e2e test in Electron (local DAppChain node must be running first)
yarn e2e:browser
The e2e test environment can be configured by changing .env.test
(see .env.test.example
for
default values).
To debug loom-js while using it another project:
- Clone the Git repo from https://github.com/loomnetwork/loom-js
- Inside the loom-js repo run:
yarn link yarn build:dev
- In your project repo run
yarn link loom-js
. - Debug your project normally.
yarn build:dev
will compile the TypeScript source to target ES2017, which requires a lot less
transformation of async/await constructs than the ES5 code released on NPM.
Whenever you change src/proto/loom.proto
, or src/tests/tests.proto
you will need to regenerate
the corresponding *_pb.js
by running:
yarn proto
The shell must be able to locate the protoc
binary, which can be obtained from https://github.com/google/protobuf/releases
BSD 3-Clause, see LICENSE
file for details.