1.0.5 • Published 6 years ago

redux-p2p-gundb-transport v1.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

GunDB transport for redux-p2p-middleware

Use with redux-p2p-middleware

GunDB offers offline-first replication capabilities. Use this module to replicate redux actions using GunDB. See redux-p2p-middleware for additional transports.

Install

yarn add redux-p2p-gundb-transport

Usage

var replicateActions =  require('redux-p2p-middleware')
var GunDbTransport = require('redux-p2p-gundb-transport/browser')
// For Node use 'redux-p2p-gundb-transport/node'

...
const transport = new GunDbTransport('Gun server URL')
const actionsToReplicate = ['DRAW_LINE','DRAW_RECT','DRAW_OVAL']
const replicator = replicateActions(actionsToReplicate, transport)
const store = createStore(myRootReducer, applyMiddleware(replicator))

Api

GunDbTransport(opts)

opts can be a string with the url of the gundb server or an object with additional gun options.

{
    room:'room name',
    ... other specific gundb options
}

If you set a room name, then only actions emitted by peers on the same room will be replicated.

For additional options see https://gun.eco/docs/API#gun

Setup a Gun Server

A gun server adds persistence (files, S3, etc) and distributes changes among peers.

Example for express

1.0.5

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago