rxjs-redux-snippets

RxJS and Redux Observable Atom Snippets for async and event-based computations

Arielle Nguyen

268

1

Bug Reports

1.3.2

MIT

GitHub

RxJS and Redux Observables Atom snippets package

Ported for Atom from https://github.com/alanvivona/rxjs-snippets-vscode with addition of redux-observable snippets.

RxJs Snippets added:

* rxjs.Observable.from.map.filter rxomap

* rxjs.Observable.of rxoo

* rxjs.Observable.fromEvent rxofe

* rxjs.Observable.fromEventPattern rxofep

* rxjs.Observable.fromCallback rxofcall

* rxjs.Observable.fromNodeCallback rxofnode

* rxjs.Observable.create rxoc

* rxjs.Observable.empty rxoem

* rxjs.Observable.fromPromise rxofp

* rxjs.Observable.interval rxoint

* rxjs.Observable.range rxorange

* rxjs.Observable.timer rxotime

* rxjs.Observable.prototype.toCallback rxotocall

Redux-Observable Snippets:

redux-observable combined root file - rdo-root

/**
 * Import all your Epics and Reducers into single file each, which then
 * exports the root Epic
 */
import { combineEpics } from 'redux-observable';
import { combineReducers } from 'redux';
import ${1:ObjectName1}, { ${1:ObjectName1}Epic } from './${1:ObjectName1}';
import ${2:ObjectName2}, { ${2:ObjectName2}Epic } from './${2:ObjectName2}';

export const rootEpic = combineEpics(
  ${1:ObjectName1}Epic,
  ${2:ObjectName2}Epic
);

export const rootReducer = combineReducers({
  ${1:ObjectName1},
  ${2:ObjectName2}
});

redux-observable configure store - rdo-store

/**
 * configureStore
 */
import { createStore, applyMiddleware } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import { rootEpic, rootReducer } from './modules/root';

const epicMiddleware = createEpicMiddleware(rootEpic);

export default function configureStore() {
  const store = createStore(
    rootReducer,
    applyMiddleware(epicMiddleware)
  );


return store;
}

redux-observable epic - rdo-epic

/**
 * ${1:epicName} epic sample
 */
const ${1:epicName}Epic = action$ =>
  action$.filter(action => action.type === ${2:ACTION1})
    .mapTo({ type: ${3:ACTION2} });

// later...
dispatch({ type: ${2:ACTION1} });

RxJs Snippets Example