Skip to content

Instantly share code, notes, and snippets.

export default {
// The main routes expects an object rather than an array. We can use this
// to configure the routes and how they will behave.
// When we are attempting to render a secured route the onSecureRequest will
// be called. This should provide a promise that resolves to a SecurityProvider
// component which will wrap any secure routes.
//
// As we nest routes, new onSecureRequest properties will be used if provided, otherwise
// any secure routes will use the first onSecureRequest
@bradennapier
bradennapier / async-process.js
Created June 19, 2017 04:53
Asynchronous Redux-Saga-Process
import { Process } from 'redux-saga-process';
const build_config = config => ({
pid: 'async',
exports: ['actions', 'selectors'],
log: false,
...config,
});
const loadProcessOnAction = 'AUTH_SESSION';
@bradennapier
bradennapier / redux-css.js
Created June 17, 2017 20:40
redux-css simple example
import { createStore, applyMiddleware, compose } from 'redux'
import reduxCSS from 'redux-css'
import reducers from './reducers'
/*
initial styles are the variables that we should set immediately.
Note that '--' is optional, it will be added for you if you don't
include it.
Objects are flattened { myKey: { myNested: 'red' } } -> --myKeymyNested: red
@bradennapier
bradennapier / async-redux-saga-process.js
Last active June 19, 2017 04:56
redux-saga process with code-splitting & hot reloading
import { Process } from 'redux-saga-process';
import { call, put } from 'redux-saga/effects';
import { createSelector } from 'reselect';
import { createTaskManager } from 'saga-task-manager';
import startUserPositionObserver from 'saga-geolocation-observer';
import handleUserPosition from './sagas/handleUserPosition';
@bradennapier
bradennapier / redux-saga-process-geolocation.js
Created June 15, 2017 23:56
Geolocation with Redux-Saga-Process
import { Process } from 'redux-saga-process'
import { call, put } from 'redux-saga/effects'
import { createSelector } from 'reselect'
import { createTaskManager } from 'saga-task-manager'
import startUserPositionObserver from 'saga-geolocation-observer'
import handleUserPosition from './sagas/handleUserPosition'
@bradennapier
bradennapier / errorObserver.js
Last active June 15, 2017 23:34
Error Event and Promise Rejection Monitor via Saga and saga-event-observer
import { call } from 'redux-saga/effects'
import eventObserverSaga from 'saga-event-observer'
/*
handlers looks something like this:
this.eventHandlers = {
onEvent: [ this, this.handleEvent ],
onError: [ this, this.handleError ],
onCancel: [ this, this.handleCancel ],