1.2.4 • Published 7 years ago

time-state v1.2.4

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago

Time State

Store and fetch historical values of a state (Flow friendly!)

Installation

$ npm install time-state

Usage

First import time-state

const TS = require('time-state');

Then create a factory (see FactoryOptions)

const factory = TS.factory({/* options */});

Storage

Each factory requires a StorageProvider. time-state provides three options:

MongoDB

time-state will create a timestate and block collection

const storage = await TS.Storage.mongo('mongodb://localhost:27017/testdb');
// OR provide collection names
const storage = await TS.Storage.mongo('mongodb://localhost:27017/testdb', 'timestates', 'blocks');
Memory

time-state will store everything in memory

const storage = TS.Storage.memory();
// Save and load storage.provider.timeStates for persistence
Create your own

Feel free to implement StorageProvider. See storage/mongo.js and storage/memory.js.

Examples

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago