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:
rxomap
* rxjs.Observable.from.map.filter rxoo
* rxjs.Observable.of rxofe
* rxjs.Observable.fromEvent rxofep
* rxjs.Observable.fromEventPattern rxofcall
* rxjs.Observable.fromCallback rxofnode
* rxjs.Observable.fromNodeCallback rxoc
* rxjs.Observable.create rxoem
* rxjs.Observable.empty rxofp
* rxjs.Observable.fromPromise rxoint
* rxjs.Observable.interval rxorange
* rxjs.Observable.range rxotime
* rxjs.Observable.timer rxotocall
* rxjs.Observable.prototype.toCallback Redux-Observable Snippets:
rdo-root
redux-observable combined root file - /**
* 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}
});
rdo-store
redux-observable configure 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;
}
rdo-epic
redux-observable 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} });