oo-redux-utils
Advanced tools
Comparing version 1.3.0 to 1.3.1
"use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _AbstractAction = _interopRequireDefault(require("./AbstractAction")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
//# sourceMappingURL=DispatchWrapper.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "default", { | ||
Object.defineProperty(exports, "OOReduxUtils", { | ||
enumerable: true, | ||
@@ -9,0 +9,0 @@ get: function get() { |
@@ -8,2 +8,4 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _AbstractAction = _interopRequireDefault(require("./AbstractAction")); | ||
@@ -13,2 +15,6 @@ | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -50,7 +56,7 @@ | ||
key: "createStateReducer", | ||
value: function createStateReducer(initialState, actionBaseClass, stateNamespace, componentClass) { | ||
value: function createStateReducer(initialState, actionBaseClass, stateNamespace, componentType) { | ||
return function () { | ||
var currentState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var action = arguments.length > 1 ? arguments[1] : undefined; | ||
return (action.receivingComponentClass && action.receivingComponentClass === componentClass || !action.receivingComponentClass && action.type instanceof actionBaseClass) && action.type.getStateNamespace() === stateNamespace ? action.type.performActionAndReturnNewState(currentState) : currentState; | ||
return (action.receivingComponentType && action.receivingComponentType === componentType || !action.receivingComponentType && action.type instanceof actionBaseClass) && action.type.getStateNamespace() === stateNamespace ? action.type.performActionAndReturnNewState(currentState) : currentState; | ||
}; | ||
@@ -57,0 +63,0 @@ } |
{ | ||
"name": "oo-redux-utils", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Utility functions for Object-oriented Redux", | ||
@@ -18,2 +18,3 @@ "keywords": [ | ||
"flow": "flow ./src", | ||
"stop-flow": "flow stop", | ||
"build": "babel ./src --out-dir ./lib --source-maps && flow-copy-source ./src ./lib", | ||
@@ -20,0 +21,0 @@ "prebuild": "npm run clean && npm run flow && npm run test", |
@@ -71,8 +71,21 @@ # Object-oriented Redux Utils | ||
### Create state reducer | ||
### Create app state type | ||
AppState.js | ||
// @flow | ||
import type { PersonState } from './PersonState' | ||
export type AppState = $Exact<{ | ||
personState: PersonState | ||
}>; | ||
### Create state store | ||
store.js | ||
// @flow | ||
import { createStore, combineReducers } from 'redux'; | ||
import { OOReduxUtils } from 'oo-redux-utils'; | ||
import OOReduxUtils from 'oo-redux-utils'; | ||
import type { AppState } from AppState' | ||
import initialPersonState from './initialPersonState'; | ||
@@ -89,12 +102,2 @@ | ||
### Create app state type | ||
// @flow | ||
import type { PersonState } from './PersonState' | ||
export type AppState = { | ||
personState: PersonState | ||
}; | ||
### Use person state in React component | ||
@@ -101,0 +104,0 @@ PersonView.js |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22251
112
155
15