Skip to content

Commit

Permalink
Bump 0.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kuy committed Jan 29, 2016
1 parent e13cb9e commit a12643d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
14 changes: 9 additions & 5 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ function getToken(state, name) {
}
}

var CANCEL_TYPES = [_actions.SHOW, _actions.HIDE];

function middleware(store) {
return function (next) {
return function (action) {
// Clear timeout
var names = (0, _utils.resolve)(action);
names.forEach(function (name) {
var token = getToken(store.getState(), name);
token && clearTimeout(token);
});
if (CANCEL_TYPES.indexOf(action.type) !== -1) {
// Clear timeout
names.forEach(function (name) {
var token = getToken(store.getState(), name);
token && clearTimeout(token);
});
}

if (!action.meta || !action.meta[_actions.DELAY]) {
return next(action);
Expand Down
6 changes: 3 additions & 3 deletions lib/origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var Origin = function (_Component) {
if (!props.onMouseEnter) {
// Set default hover handler
props.onMouseEnter = function (e) {
var action = _this2.props.delayOn === 'show' ? _this2.createWithDelay(_actions.show, { el: e.target }) : (0, _actions.show)(_extends({}, _this2.props, { el: e.target }));
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 }));
_this2.props.dispatch(action);
_this2.props.onHover && _this2.props.onHover(e);
};
Expand All @@ -65,7 +65,7 @@ var Origin = function (_Component) {
if (!props.onMouseLeave) {
// Set default leave handler
props.onMouseLeave = function (e) {
var action = _this2.props.delayOn === 'hide' ? _this2.createWithDelay(_actions.hide) : (0, _actions.hide)(_extends({}, _this2.props));
var action = ['hide', 'both'].indexOf(_this2.props.delayOn) !== -1 ? _this2.createWithDelay(_actions.hide) : (0, _actions.hide)(_extends({}, _this2.props));
_this2.props.dispatch(action);
_this2.props.onLeave && _this2.props.onLeave(e);
};
Expand All @@ -90,7 +90,7 @@ var Origin = function (_Component) {
content: _react.PropTypes.string,
place: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
delay: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.number, _react.PropTypes.string]),
delayOn: _react.PropTypes.oneOf(['show', 'hide']),
delayOn: _react.PropTypes.oneOf(['show', 'hide', 'both']),
onMouseEnter: _react.PropTypes.func,
onMouseLeave: _react.PropTypes.func
};
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-tooltip",
"version": "0.4.3",
"version": "0.4.4",
"description": "A tooltip React component for Redux",
"main": "./lib/index.js",
"repository": {
Expand Down Expand Up @@ -52,13 +52,13 @@
"karma-mocha-reporter": "^1.1.5",
"karma-sinon": "^1.0.4",
"karma-webpack": "^1.7.0",
"mocha": "^2.4.4",
"mocha": "^2.4.5",
"power-assert": "^1.2.0",
"react": "^0.14.6",
"react-addons-test-utils": "^0.14.6",
"react-dom": "^0.14.6",
"react-redux": "^4.0.6",
"redux": "^3.0.6",
"react": "^0.14.7",
"react-addons-test-utils": "^0.14.7",
"react-dom": "^0.14.7",
"react-redux": "^4.1.1",
"redux": "^3.1.2",
"redux-logger": "^2.4.0",
"rimraf": "^2.5.1",
"sinon": "^1.17.3",
Expand Down

0 comments on commit a12643d

Please sign in to comment.