reshow-hooks
Advanced tools
Comparing version 0.17.36 to 0.17.37
@@ -18,3 +18,8 @@ "use strict"; | ||
*/ | ||
/** | ||
* @typedef {object&React.MouseEvent} LongPressEvent | ||
* @property {HTMLElement} currentItem | ||
*/ | ||
/** | ||
* @param {Function} callback | ||
@@ -34,4 +39,6 @@ * @param {LongPressPayload} payload | ||
return (0, _react.useMemo)(function () { | ||
var start = function start( /**@type React.MouseEvent*/e) { | ||
var currentTarget = e === null || e === void 0 ? void 0 : e.currentTarget; | ||
var start = function start( /**@type LongPressEvent*/e) { | ||
if (e !== null && e !== void 0 && e.currentTarget) { | ||
e.currentItem = e.currentTarget; | ||
} | ||
if (isStart.current) { | ||
@@ -45,6 +52,6 @@ return; | ||
onStart = _lastPayload$current.onStart; | ||
(0, _callFunc["default"])(onStart, [e, currentTarget]); | ||
(0, _callFunc["default"])(onStart, [e]); | ||
timerRun(function () { | ||
done(); | ||
(0, _callFunc["default"])(callback, [e, currentTarget]); | ||
(0, _callFunc["default"])(callback, [e]); | ||
}, threshold); | ||
@@ -56,3 +63,3 @@ }; | ||
}; | ||
var cancel = function cancel( /**@type React.MouseEvent*/e) { | ||
var cancel = function cancel( /**@type LongPressEvent*/e) { | ||
if (!isStart.current) { | ||
@@ -62,5 +69,7 @@ return; | ||
done(); | ||
var currentTarget = e === null || e === void 0 ? void 0 : e.currentTarget; | ||
if (e !== null && e !== void 0 && e.currentTarget) { | ||
e.currentItem = e.currentTarget; | ||
} | ||
var onCancel = lastPayload.current.onCancel; | ||
(0, _callFunc["default"])(onCancel, [e, currentTarget]); | ||
(0, _callFunc["default"])(onCancel, [e]); | ||
}; | ||
@@ -67,0 +76,0 @@ var mouseHandlers = { |
{ | ||
"version": "0.17.36", | ||
"version": "0.17.37", | ||
"name": "reshow-hooks", | ||
@@ -4,0 +4,0 @@ "repository": { |
@@ -10,1 +10,2 @@ export { default as useDebounce } from "./useDebounce"; | ||
export { default as useTimer } from "./useTimer"; | ||
export type LongPressEvent = import('./useLongPress').LongPressEvent; |
@@ -7,2 +7,3 @@ export default useLongPress; | ||
}; | ||
export type LongPressEvent = object & React.MouseEvent; | ||
/** | ||
@@ -15,2 +16,6 @@ * @typedef {object} LongPressPayload | ||
/** | ||
* @typedef {object&React.MouseEvent} LongPressEvent | ||
* @property {HTMLElement} currentItem | ||
*/ | ||
/** | ||
* @param {Function} callback | ||
@@ -20,7 +25,7 @@ * @param {LongPressPayload} payload | ||
declare function useLongPress(callback: Function, payload?: LongPressPayload): { | ||
onTouchStart: (e: React.MouseEvent) => void; | ||
onTouchMove: (e: React.MouseEvent) => void; | ||
onMouseDown: (e: React.MouseEvent) => void; | ||
onMouseUp: (e: React.MouseEvent) => void; | ||
onMouseLeave: (e: React.MouseEvent) => void; | ||
onTouchStart: (e: LongPressEvent) => void; | ||
onTouchMove: (e: LongPressEvent) => void; | ||
onMouseDown: (e: LongPressEvent) => void; | ||
onMouseUp: (e: LongPressEvent) => void; | ||
onMouseLeave: (e: LongPressEvent) => void; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33917
1016