Skip to content

Commit a12643d

Browse files
committed
Bump 0.4.4
1 parent e13cb9e commit a12643d

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

lib/middleware.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ function getToken(state, name) {
1818
}
1919
}
2020

21+
var CANCEL_TYPES = [_actions.SHOW, _actions.HIDE];
22+
2123
function middleware(store) {
2224
return function (next) {
2325
return function (action) {
24-
// Clear timeout
2526
var names = (0, _utils.resolve)(action);
26-
names.forEach(function (name) {
27-
var token = getToken(store.getState(), name);
28-
token && clearTimeout(token);
29-
});
27+
if (CANCEL_TYPES.indexOf(action.type) !== -1) {
28+
// Clear timeout
29+
names.forEach(function (name) {
30+
var token = getToken(store.getState(), name);
31+
token && clearTimeout(token);
32+
});
33+
}
3034

3135
if (!action.meta || !action.meta[_actions.DELAY]) {
3236
return next(action);

lib/origin.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var Origin = function (_Component) {
5656
if (!props.onMouseEnter) {
5757
// Set default hover handler
5858
props.onMouseEnter = function (e) {
59-
var action = _this2.props.delayOn === 'show' ? _this2.createWithDelay(_actions.show, { el: e.target }) : (0, _actions.show)(_extends({}, _this2.props, { el: e.target }));
59+
var action = ['show', 'both'].indexOf(_this2.props.delayOn) !== -1 ? _this2.createWithDelay(_actions.show, { el: e.target }) : (0, _actions.show)(_extends({}, _this2.props, { el: e.target }));
6060
_this2.props.dispatch(action);
6161
_this2.props.onHover && _this2.props.onHover(e);
6262
};
@@ -65,7 +65,7 @@ var Origin = function (_Component) {
6565
if (!props.onMouseLeave) {
6666
// Set default leave handler
6767
props.onMouseLeave = function (e) {
68-
var action = _this2.props.delayOn === 'hide' ? _this2.createWithDelay(_actions.hide) : (0, _actions.hide)(_extends({}, _this2.props));
68+
var action = ['hide', 'both'].indexOf(_this2.props.delayOn) !== -1 ? _this2.createWithDelay(_actions.hide) : (0, _actions.hide)(_extends({}, _this2.props));
6969
_this2.props.dispatch(action);
7070
_this2.props.onLeave && _this2.props.onLeave(e);
7171
};
@@ -90,7 +90,7 @@ var Origin = function (_Component) {
9090
content: _react.PropTypes.string,
9191
place: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
9292
delay: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.number, _react.PropTypes.string]),
93-
delayOn: _react.PropTypes.oneOf(['show', 'hide']),
93+
delayOn: _react.PropTypes.oneOf(['show', 'hide', 'both']),
9494
onMouseEnter: _react.PropTypes.func,
9595
onMouseLeave: _react.PropTypes.func
9696
};

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-tooltip",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "A tooltip React component for Redux",
55
"main": "./lib/index.js",
66
"repository": {
@@ -52,13 +52,13 @@
5252
"karma-mocha-reporter": "^1.1.5",
5353
"karma-sinon": "^1.0.4",
5454
"karma-webpack": "^1.7.0",
55-
"mocha": "^2.4.4",
55+
"mocha": "^2.4.5",
5656
"power-assert": "^1.2.0",
57-
"react": "^0.14.6",
58-
"react-addons-test-utils": "^0.14.6",
59-
"react-dom": "^0.14.6",
60-
"react-redux": "^4.0.6",
61-
"redux": "^3.0.6",
57+
"react": "^0.14.7",
58+
"react-addons-test-utils": "^0.14.7",
59+
"react-dom": "^0.14.7",
60+
"react-redux": "^4.1.1",
61+
"redux": "^3.1.2",
6262
"redux-logger": "^2.4.0",
6363
"rimraf": "^2.5.1",
6464
"sinon": "^1.17.3",

0 commit comments

Comments
 (0)