0.1.22 • Published 6 years ago

redux-bluetooth v0.1.22

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

Redux middleware to dispatch actions via bluetooth to a peripheral store

Build Status codecov gzip size

Redux Bluetooth is a project which consists in two components: webapp middleware, is a redux middleware to dispatch actions via web bluetooth. peripheral store, is a redux store which process actions received over bluetooth and notify changes on every store change.

Install

$ npm install redux-bluetooth

Usage

Webapp

import { createSyncStore } from 'redux-bluetooth/build/webapp';

// ACTIONS, list of actions types to dispatch over bluetooth
const store = createSyncStore(ACTIONS);
import { connect } from 'react-redux';
import { actions } from 'redux-bluetooth/build/webapp';

import Component from './component';

const mapState = state => state;

const mapAction = {
  onConnect: actions.connectStore,
};

export { Component };
export default connect(mapState, mapAction)(Component);

Warning: actions.connectStore must be trigger by an user action. more info

Peripheral

import { connectSyncStore } from 'redux-bluetooth/build/peripheral';

// NAME, name of the peripehral
// STORE, redux store
connectSyncStore(NAME, STORE);

Example

Set up

First, clone this repo and install example dependencies

$ git clone git@github.com:jvallelunga/redux-bluetooth.git
$ cd redux-bluetooth
$ npm run example:install

Start Peripheral

Make sure you have your bluetooth enabled

$ npm run example:start

Open Webapp

Before starting the webapp, go to chrome://flags/#enable-experimental-web-platform-features, enable the highlighted flag, and restart Chrome on your mobile.

Then, Make sure you have your bluetooth enabled.

Finally, open this url https://jvallelunga.github.io/redux-bluetooth/ on your mobile.

0.1.22

6 years ago

0.1.21

6 years ago

0.1.20

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago