项目作者: viniciusbo

项目描述 :
MQTT.js localForage Store for the browser
高级语言: JavaScript
项目地址: git://github.com/viniciusbo/mqtt-localforage-store.git
创建时间: 2017-11-09T15:50:34Z
项目社区:https://github.com/viniciusbo/mqtt-localforage-store

开源协议:

下载


MQTT.js localForage Store for the browser

Build Status

Installation

NPM

  1. yarn add mqtt-localforage-store localforage
  2. # or
  3. npm install --save mqtt-localforage-store

Compile yourself

  1. git clone git@github.com:viniciusbo/mqtt-localforage-store.git && cd mqtt-localforage-store
  2. yarn # or npm install
  3. npm run build
  4. cd /dist

Distribution bundles are located in /dist folder. The build exposes the MQTTLocalForageStore globally.

Usage

  1. import localForage from 'localforage';
  2. import Store as MQTTLocalForageStore from 'mqtt-localforage-store';
  3. // Make your own localForage instances
  4. const incomingDb = localForage.createInstance({ name: 'incomingPackets' });
  5. const outgoingDb = localForage.createInstance({ name: 'outgoingPackets' });
  6. const incomingStore = MQTTLocalForageStore(incomingDb);
  7. const outgoingStore = MQTTLocalForageStore(outgoingDb);
  8. mqtt.connect({
  9. // ...
  10. incomingStore,
  11. outgoingStore,
  12. });

Test

  1. yarn # or npm install
  2. npm run test