npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redux-location

v0.0.17

Published

Redux service to request and store multiple user geolocation

Downloads

21

Readme

redux-location NPM version Discord

Redux service to request and store multiple user geolocation

alt tag

alt tag

FEATURES

  • Service architecture (redux-manager powered)
  • Journaling (redux-journal powered)
  • Persist state (PouchDB powered)
  • Dynamic service configuration (state.config):
    • docsMax = 2 - maximum docs in state.docs
    • docsMaxOverRemove: true - remove old locations over docsMax

INSTALL

Stable

npm i -S redux-location

Dev

npm i -S lokhmakov/redux-location

EXAMPLES

REACT

npm run react

client.js

require('redux-journal').enable()

import injectTapEventPlugin from 'react-tap-event-plugin'

injectTapEventPlugin()

import PouchDB              from 'pouchdb'

import { manager }          from 'redux-manager'
import { locationLocal }    from 'redux-location'
import { locationPersist }  from 'redux-location'

const service1 = 'location'
const service2 = 'location2'
const service3 = 'location3'

locationLocal({ serviceName: service1 })
locationPersist({ db: PouchDB('redux-location'), serviceList: [service1] })

locationLocal({ serviceName: service2 })
locationLocal({ serviceName: service3 })

manager.enableLogger(require('redux-logger')())
const store = manager.getStore()

import React                from 'react'
import ReactDOM             from 'react-dom'
import { Provider }         from 'react-redux'
import { connect }          from 'react-redux'

import MuiThemeProvider     from 'material-ui/styles/MuiThemeProvider'
import getMuiTheme          from 'material-ui/styles/getMuiTheme'

import { LocationBadge }    from 'redux-location'
import { LocationButton }   from 'redux-location'
import { LocationObserver } from 'redux-location'

const LocationBadge1    = connect(state => ({ location: state[service1] }))(LocationBadge)
const LocationBadge2    = connect(state => ({ location: state[service2] }))(LocationBadge)
const LocationBadge3    = connect(state => ({ location: state[service3] }))(LocationBadge)
const LocationButton3   = connect(state => ({ location: state[service3] }))(LocationButton)
const LocationObserver3 = connect(state => ({ location: state[service3] }))(LocationObserver)

const muiTheme = getMuiTheme({ palette: { accent1Color: require('material-ui/styles/colors').deepOrange500 }})

const render = () => ReactDOM.render(
  <Provider store={ store }>
    <MuiThemeProvider muiTheme={ muiTheme }>
      <div>
        <LocationBadge1 serviceName={ service1 } />
        <LocationBadge2   serviceName={ service2 } />
        <LocationBadge3   serviceName={ service3 } />
        <LocationButton3  serviceName={ service3 } />
        <LocationObserver3 />
      </div>
    </MuiThemeProvider>
  </Provider>,
  document.getElementById('root')
)

render()

NODE-API

npm run node

require('redux-journal').enable()

import { write, error }   from 'redux-journal'
import { manager }        from 'redux-manager'
import { locationLocal }  from 'redux-location'

const api = locationLocal()

manager.enableLogger(require('redux-node-logger')())
manager.getStore()

api.locate().then((position) => {
  write(position)
}).catch((e) => {
  error(e)
})

PERSIST

npm run persist

alt tag

require('redux-journal').enable()

import PouchDB              from 'pouchdb'
import { manager }          from 'redux-manager'
import { locationActions }  from 'redux-location'
import { locationLocal }    from 'redux-location'
import { locationPersist }  from 'redux-location'

const db = PouchDB('data/location', { db: require('memdown') })

locationLocal()
locationPersist({ db })

manager.enableLogger(require('redux-node-logger')())
manager.getStore()

manager.dispatch(locationActions.insert({ lat: 'latitude', lng: 'longitude' }), 'location')