Noodles Practicing Medicine

    redux-p2p-gundb-transport

    1.0.5 • Public • Published

    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

    Install

    npm i redux-p2p-gundb-transport

    DownloadsWeekly Downloads

    2

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    572 kB

    Total Files

    12

    Last publish

    Collaborators

    • hugozap