browser-redux-bg
Advanced tools
Comparing version
@@ -24,3 +24,3 @@ 'use strict'; | ||
exports.configureBg = _configure2['default']; | ||
exports.combineReducers = _reducers2['default']; | ||
exports.bgReducer = _reducers2['default']; | ||
exports.bgActions = bgActions; |
@@ -6,13 +6,7 @@ 'use strict'; | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _redux = require('redux'); | ||
var rootReducer = function rootReducer(reducers, isFromBackground) { | ||
var extension = isFromBackground ? require('./receive') : require('./send'); | ||
return (0, _redux.combineReducers)(_extends({}, reducers, { extension: extension })); | ||
var bgReducer = function bgReducer(isFromBackground) { | ||
return isFromBackground ? require('./receive') : require('./send'); | ||
}; | ||
exports['default'] = rootReducer; | ||
exports['default'] = bgReducer; | ||
module.exports = exports['default']; |
{ | ||
"name": "browser-redux-bg", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Messaging library for Cross-browser extensions and Chrome apps. Calls actions from the background script.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,6 +7,6 @@ # Messaging library for cross-browser extensions and Chrome apps | ||
```js | ||
import { createStore, compose } from 'redux' | ||
import { createStore, compose, combineReducers } from 'redux' | ||
import { persistStore, autoRehydrate } from 'redux-persist' | ||
import { configureSync, sync } from 'browser-redux-sync' | ||
import { configureBg, combineReducers } from 'browser-redux-bg'; | ||
import { configureBg, bgReducers } from 'browser-redux-bg'; | ||
@@ -19,3 +19,5 @@ import reducers from '../reducers'; | ||
const finalCreateStore = compose(autoRehydrate())(createStore) | ||
const store = finalCreateStore(combineReducers(reducers, isFromBackground)) | ||
const extension = bgReducer(isFromBackground) | ||
const rootReducer = combineReducers({ ...reducers, extension }) | ||
const store = finalCreateStore(rootReducer) | ||
const persistor = persistStore(store, configureSync(configureBg(store, actions, isFromBackground))) | ||
@@ -22,0 +24,0 @@ sync(persistor) |
import configureBg from './configure'; | ||
import combineReducers from './reducers'; | ||
import bgReducer from './reducers'; | ||
import * as bgActions from './actions/send'; | ||
@@ -7,4 +7,4 @@ | ||
configureBg, | ||
combineReducers, | ||
bgReducer, | ||
bgActions | ||
}; |
@@ -1,8 +0,5 @@ | ||
import { combineReducers } from 'redux'; | ||
const rootReducer = (reducers, isFromBackground) => { | ||
const extension = isFromBackground ? require('./receive') : require('./send'); | ||
return combineReducers({ ...reducers, extension }); | ||
const bgReducer = (isFromBackground) => { | ||
return isFromBackground ? require('./receive') : require('./send'); | ||
}; | ||
export default rootReducer; | ||
export default bgReducer; |
Sorry, the diff of this file is not supported yet
42793
2.75%7
600%64
3.23%190
-2.56%