Skip to content

Commit 2017129

Browse files
committed
Bump 0.5.4
1 parent f13256e commit 2017129

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,30 @@ import { reducer as tooltip } from 'redux-tooltip';
8080
// ...
8181
8282
export default combineReducers(
83-
{ your, reducers, ..., tooltip }
83+
{ your, awesome, reducers, ..., tooltip }
8484
);
8585
```
8686

8787
That's it!
8888

89+
#### [Optional] 4. Insert `redux-tooltip` middleware with yours
90+
91+
If you want to use 'delay' feature, please insert `redux-tooltip` middleware to enable the feature.
92+
93+
```
94+
import { middleware as tooltip } from 'redux-tooltip';
95+
96+
// ...
97+
98+
const store = createStore(
99+
reducer,
100+
initialstate,
101+
applyMiddleware(
102+
your, awesome, middlewares, ..., tooltip
103+
)
104+
);
105+
```
106+
89107
## API
90108

91109
### `<Tooltip />`

lib/reducer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function tooltip() {
5959
var action = arguments[1];
6060

6161
// Check usage of deprecated props
62-
(0, _utils.deprecatedWarning)(action.payload);
62+
(0, _utils.deprecatedWarning)(action);
6363

6464
var handler = handlers[action.type];
6565
return handler ? handler(state, action) : state;

lib/utils.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ var _isDom = require('is-dom');
2424

2525
var _isDom2 = _interopRequireDefault(_isDom);
2626

27+
var _actions = require('./actions');
28+
29+
var actions = _interopRequireWildcard(_actions);
30+
31+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
32+
2733
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2834

2935
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
@@ -286,11 +292,22 @@ function resolve(obj) {
286292
return names;
287293
}
288294

289-
function deprecatedWarning(props) {
290-
if (props && props.el) {
295+
var actionTypes = Object.keys(actions).map(function (k) {
296+
return actions[k];
297+
}).filter(function (e) {
298+
return typeof e === 'string';
299+
});
300+
function deprecatedWarning(action) {
301+
var type = action.type;
302+
var payload = action.payload;
303+
304+
if (actionTypes.indexOf(action.type) === -1) {
305+
return; // Ignore non-related actions
306+
}
307+
if (payload && payload.el) {
291308
console.warn('DEPRECATED: Use \'origin\' instead of \'el\' in props for Tooltip component or \'show\' action.');
292309
}
293-
if (props && props.el && props.origin) {
310+
if (payload && payload.el && payload.origin) {
294311
console.warn('Do not pass both \'origin\' and \'el\' props at the same time.');
295312
}
296313
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-tooltip",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"description": "A tooltip React component for Redux",
55
"main": "./lib/index.js",
66
"repository": {

0 commit comments

Comments
 (0)