@ipfn/runtime
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

IPFN runtime in JavaScript

IPFN project npm Dependency Status Dev Dependency Status Circle CI

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 counterexample 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.

/@ipfn/runtime/

    Package Sidebar

    Install

    npm i @ipfn/runtime

    Weekly Downloads

    0

    Version

    0.0.1

    License

    none

    Last publish

    Collaborators

    • crackcomm