3.0.1 • Published 9 years ago

redux-replicate-fs v3.0.1

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

redux-replicate-fs

npm version npm downloads

Replicator for redux-replicate designed to locally persist the state of redux stores using fs.

Table of contents

  1. Installation
  2. Usage
  3. Example using react-redux-provide
  4. Example using compose
  5. Debouncing

Installation

npm install redux-replicate-fs --save

Usage

Note: This is currently intended only for demonstration purposes! Don't use this in production. At some point we may turn this into a proper flatfile storage system though! :)

Use with redux-replicate.

Example using react-redux-provide

// src/replication.js

import fs from 'redux-replicate-fs';
import { theme } from './providers/index';

theme.replication = {
  reducerKeys: ['themeName'],
  replicator: fs
};

Example using compose

import { createStore, combineReducers, compose } from 'redux';
import replicate from 'redux-replicate';
import fs from 'redux-replicate-fs';
import reducers from './reducers';

const initialState = {
  wow: 'such storage',
  very: 'cool'
};

const key = 'superCoolStorageUnit';
const reducerKeys = true;
const replicator = fs;
const replication = replicate({ key, reducerKeys, replicator });
const create = compose(replication)(createStore);
const store = create(combineReducers(reducers), initialState);

Debouncing

By default, a debounce occurs when writing the next state to the file system (during onStateChange). The default timeout is 1 millisecond. You can change it by doing this:

import fs from 'redux-replicate-fs';

fs.debounce = 20;
3.0.1

9 years ago

3.0.0

9 years ago

2.0.0-alpha.6

9 years ago

2.0.0-alpha.5

9 years ago

2.0.0-alpha.4

9 years ago

2.0.0-alpha.3

9 years ago

2.0.0-alpha.2

9 years ago

2.0.0-alpha.1

9 years ago

2.0.0-alpha.0

9 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago