@ipfn/runtime
v0.0.1
Published
[![IPFN project](https://img.shields.io/badge/project-IPFN-blue.svg?style=flat-square)](http://github.com/ipfn) [![npm](https://img.shields.io/npm/v/@ipfn/runtime.svg?maxAge=86400&style=flat-square)](https://www.npmjs.com/package/@ipfn/runtime) [![Depende
Downloads
2
Readme
IPFN runtime in JavaScript
IPFN neurons runtime in JavaScript.
Install
This project is available through npm. To install run:
$ npm install @ipfn/runtime
Requirements
To import projects from IPFS
it should me mounted at /ipfs/
and NODE_PATH
should point to it.
$ ipfs mount
IPFS mounted at: /ipfs
IPNS mounted at: /ipns
$ export NODE_PATH=/ipfs
Usage
This example uses a counter – example package.
import Session from '@ipfn/session';
import { fire, subscribe, lookup } from '@ipfn/runtime';
// Create a new session of firings
const session = new Session();
// Lookup `Counter` neuron
const counter = lookup('QmSidsSRhbtHUGorPhNZC5HBMM6zvCgVTRa9RYH637sE2S/Counter');
// We will log to console all firings during this session
subscribe(session, counter.increment.count, count => {
console.log(`Incremented to ${count}`);
});
// Fire `5` on `count` input on `increment` neuron
fire(session, counter.increment.count, 5);
See package tests for more examples.