Comparing version 3.0.0 to 3.1.0
{ | ||
"name": "demux", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"author": { | ||
@@ -32,3 +32,3 @@ "name": "Julien Heller", | ||
"example": "./run-example.sh", | ||
"lint": "tslint -c tslint.json src/**/*.ts", | ||
"lint": "tslint -c tslint.json -p tsconfig.json", | ||
"test": "jest", | ||
@@ -39,14 +39,14 @@ "build-docs": "./build-docs.sh" | ||
"moduleFileExtensions": [ | ||
"js", | ||
"ts", | ||
"tsx", | ||
"js" | ||
"tsx" | ||
], | ||
"transform": { | ||
"^.+\\.(tsx?)$": "ts-jest" | ||
}, | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfigFile": "tsconfig.json" | ||
"tsConfig": "tsconfig.json" | ||
} | ||
}, | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": "(/src/.*(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
@@ -53,0 +53,0 @@ "testEnvironment": "node" |
@@ -60,14 +60,3 @@ # demux-js [![Build Status](https://travis-ci.org/EOSIO/demux-js.svg?branch=develop)](https://travis-ci.org/EOSIO/demux-js) | ||
## Usage | ||
This library provides the following classes: | ||
* [**`AbstractActionReader`**](https://eosio.github.io/demux-js/classes/abstractactionreader.html): Abstract class used for implementing your own Action Readers | ||
* [**`AbstractActionHandler`**](https://eosio.github.io/demux-js/classes/abstractactionhandler.html): Abstract class used for implementing your own Action Handlers | ||
* [**`BaseActionWatcher`**](https://eosio.github.io/demux-js/classes/baseactionwatcher.html): Base class that implements a ready-to-use Action Watcher | ||
#### [**View full API documentation here.**](https://eosio.github.io/demux-js/) | ||
## Class Implementations | ||
@@ -86,38 +75,29 @@ | ||
## Example | ||
## Usage | ||
```js | ||
// Let's read from an EOS node | ||
const { NodeosActionReader } = require("demux-eos") | ||
// Assuming you've created your own subclass of AbstractActionHandler | ||
const MyActionHandler = require("./MyActionHandler") | ||
// Ties everything together in a polling loop | ||
const { BaseActionWatcher } = require("demux") | ||
This library provides the following classes: | ||
// Import Updaters and Effects, which are arrays of objects: | ||
// [ { actionType: string, (updater|effect): function }, ... ] | ||
const updaters = require("./updaters") | ||
const effects = require("./effects") | ||
* [**`AbstractActionReader`**](https://eosio.github.io/demux-js/classes/abstractactionreader.html): Abstract class used for implementing your own Action Readers | ||
const actionReader = new NodeosActionReader( | ||
"http://some-nodeos-endpoint:8888", // Locally hosted node needed for reasonable indexing speed | ||
12345678, // First actions relevant to this dapp happen at this block | ||
) | ||
* [**`AbstractActionHandler`**](https://eosio.github.io/demux-js/classes/abstractactionhandler.html): Abstract class used for implementing your own Action Handlers | ||
const actionHandler = new MyActionHandler( | ||
updaters, | ||
effects, | ||
) | ||
* [**`BaseActionWatcher`**](https://eosio.github.io/demux-js/classes/baseactionwatcher.html): Base class that implements a ready-to-use Action Watcher | ||
const actionWatcher = new BaseActionWatcher( | ||
actionReader, | ||
actionHandler, | ||
250, // Poll at twice the block interval for less latency | ||
) | ||
In order to process actions, we need the following things: | ||
actionWatcher.watch() // Start watch loop | ||
``` | ||
- An implementation of an `AbstractActionReader` | ||
- An implementation of an `AbstractActionHandler` | ||
- At least one `HandlerVersion`, which contain `Updater` and `Effect` arrays | ||
For more complete examples, [see the examples directory](examples/). | ||
After we have these things, we need to: | ||
- Instantiate the implemented `AbstractActionHandler`, passing in the `HandlerVersion` and any other needed configuration | ||
- Instantiate the implemented `AbstractActionReader` with any needed configuration | ||
- Instantiate a `BaseActionWatcher`, passing in the above Handler and Reader instances | ||
- Call `watch()` on the Watcher | ||
### [**API documentation**](https://eosio.github.io/demux-js/) | ||
### [Learn from a full example](examples/eos-transfers) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
288167
102