app3-core-subscriptions

Manages app3 subscriptions. This is an internal package.

Usage no npm install needed!

<script type="module">
  import app3CoreSubscriptions from 'https://cdn.skypack.dev/app3-core-subscriptions';
</script>

README

app3-core-subscriptions

This is a sub package of app3.js

The subscriptions package used within some app3.js packages. Please read the documentation for more.

Installation

Node.js

npm install app3-core-subscriptions

In the Browser

Build running the following in the app3.js repository:

npm run-script build-all

Then include dist/app3-core-subscriptions.js in your html file. This will expose the App3Subscriptions object on the window object.

Usage

// in node.js
var App3Subscriptions = require('app3-core-subscriptions');

var sub = new App3Subscriptions({
    name: 'subscribe',
    type: 'apis',
    subscriptions: {
        'newBlockHeaders': {
            subscriptionName: 'newHeads',
            params: 0,
            outputFormatter: formatters.outputBlockFormatter
        },
        'pendingTransactions': {
            params: 0,
            outputFormatter: formatters.outputTransactionFormatter
        }
    }
});
sub.attachToObject(myCoolLib);

myCoolLib.subscribe('newBlockHeaders', function(){ ... });