pec-core-subscriptions
v1.0.5
Published
Manages pec subscriptions. This is an internal package.
Downloads
7
Readme
pec-core-subscriptions
[![NPM Package][npm-image]][npm-url] [![Dependency Status][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url]tus][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url]
This is a sub-package of [pec.js][repo]
This subscriptions package is used within some [pec.js][repo] packages.
Please read the [documentation][docs] for more.
Installation
Node.js
npm install pec-core-subscriptions
Usage
const Web3Subscriptions = require('pec-core-subscriptions');
const sub = new Web3Subscriptions({
name: 'subscribe',
type: 'pec',
subscriptions: {
'newBlockHeaders': {
subscriptionName: 'newHeads',
params: 0,
outputFormatter: formatters.outputBlockFormatter
},
'pendingTransactions': {
params: 0,
outputFormatter: formatters.outputTransactionFormatter
}
}
});
sub.attachToObject(myCoolLib);
myCoolLib.subscribe('newBlockHeaders', function(){ ... });