@bearei/react-util
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -34,7 +34,9 @@ /******/ var __webpack_modules__ = ({ | ||
var handleEvent = function handleEvent(e, callback) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
@@ -47,3 +49,3 @@ var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
}; | ||
return _defineProperty({}, event[(0,_getPlatform__WEBPACK_IMPORTED_MODULE_0__/* .getPlatform */ .X)()], eventFun); | ||
return _defineProperty({}, event[(0,_getPlatform__WEBPACK_IMPORTED_MODULE_0__/* .getPlatform */ .X)()], handleEvent(eventFun)); | ||
}; | ||
@@ -50,0 +52,0 @@ |
/// <reference types="react" /> | ||
import { GestureResponderEvent } from 'react-native'; | ||
export declare type EventType = 'onClick' | 'onPress' | 'onTouchEnd'; | ||
export declare type Fun = () => unknown; | ||
export declare type HandleEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement> | GestureResponderEvent; | ||
export declare type EventFun = (e?: HandleEvent) => unknown; | ||
export declare const handleEvent: (e?: HandleEvent, callback?: Fun) => unknown; | ||
export declare const handleEvent: (callback?: EventFun) => (e?: HandleEvent) => unknown; | ||
export declare const getPlatformEvent: (eventFun?: EventFun) => Record<EventType, EventFun | undefined>; |
@@ -79,7 +79,9 @@ /******/ var __webpack_modules__ = ({ | ||
var handleEvent = function handleEvent(e, callback) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
@@ -92,3 +94,3 @@ var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
}; | ||
return _defineProperty({}, event[(0,_getPlatform__WEBPACK_IMPORTED_MODULE_0__/* .getPlatform */ .X)()], eventFun); | ||
return _defineProperty({}, event[(0,_getPlatform__WEBPACK_IMPORTED_MODULE_0__/* .getPlatform */ .X)()], handleEvent(eventFun)); | ||
}; | ||
@@ -95,0 +97,0 @@ }(); |
@@ -75,7 +75,9 @@ /******/ (function() { // webpackBootstrap | ||
var getPlatform_1 = __webpack_require__(405); | ||
var handleEvent = function handleEvent(e, callback) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
@@ -89,3 +91,3 @@ exports.handleEvent = handleEvent; | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], eventFun); | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], (0, exports.handleEvent)(eventFun)); | ||
}; | ||
@@ -92,0 +94,0 @@ exports.getPlatformEvent = getPlatformEvent; |
/// <reference types="react" /> | ||
import { GestureResponderEvent } from 'react-native'; | ||
export declare type EventType = 'onClick' | 'onPress' | 'onTouchEnd'; | ||
export declare type Fun = () => unknown; | ||
export declare type HandleEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement> | GestureResponderEvent; | ||
export declare type EventFun = (e?: HandleEvent) => unknown; | ||
export declare const handleEvent: (e?: HandleEvent, callback?: Fun) => unknown; | ||
export declare const handleEvent: (callback?: EventFun) => (e?: HandleEvent) => unknown; | ||
export declare const getPlatformEvent: (eventFun?: EventFun) => Record<EventType, EventFun | undefined>; |
@@ -28,2 +28,34 @@ /******/ (function() { // webpackBootstrap | ||
/***/ }), | ||
/***/ 668: | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.getPlatformEvent = exports.handleEvent = void 0; | ||
var getPlatform_1 = __webpack_require__(405); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
exports.handleEvent = handleEvent; | ||
var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
var event = { | ||
reactNative: 'onPress', | ||
pcBrowser: 'onClick', | ||
mobileBrowser: 'onTouchEnd' | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], (0, exports.handleEvent)(eventFun)); | ||
}; | ||
exports.getPlatformEvent = getPlatformEvent; | ||
/***/ }) | ||
@@ -58,35 +90,12 @@ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | ||
!function() { | ||
var exports = __webpack_exports__; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.getPlatformEvent = exports.handleEvent = void 0; | ||
var getPlatform_1 = __webpack_require__(405); | ||
var handleEvent = function handleEvent(e, callback) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(); | ||
}; | ||
exports.handleEvent = handleEvent; | ||
var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
var event = { | ||
reactNative: 'onPress', | ||
pcBrowser: 'onClick', | ||
mobileBrowser: 'onTouchEnd' | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], eventFun); | ||
}; | ||
exports.getPlatformEvent = getPlatformEvent; | ||
}(); | ||
var __webpack_export_target__ = exports; | ||
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; | ||
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module is referenced by other modules so it can't be inlined | ||
/******/ var __webpack_exports__ = __webpack_require__(668); | ||
/******/ var __webpack_export_target__ = exports; | ||
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; | ||
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); | ||
/******/ | ||
/******/ })() | ||
; |
{ | ||
"name": "@bearei/react-util", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
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
38452
543