New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-mkx-toolkit

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mkx-toolkit - npm Package Compare versions

Comparing version 1.7.6 to 1.7.7

33

dist/useKeyboard/index.js

@@ -5,31 +5,16 @@ "use strict";

const useKeyboard = (key, callback) => {
const handleKeyDown = (0, react_1.useCallback)((event) => {
if (event.key === key) {
event.preventDefault();
callback();
}
}, [key, callback]);
(0, react_1.useEffect)(() => {
const handleKeyDown = (event) => {
try {
if (event.key === key) {
event.preventDefault();
callback();
}
}
catch (error) {
console.error("Error in useKeyboard hook:", error);
}
};
try {
window.addEventListener("keydown", handleKeyDown);
}
catch (error) {
console.error("Error adding event listener in useKeyboard hook:", error);
}
window.addEventListener("keydown", handleKeyDown);
return () => {
try {
window.removeEventListener("keydown", handleKeyDown);
}
catch (error) {
console.error("Error removing event listener in useKeyboard hook:", error);
}
window.removeEventListener("keydown", handleKeyDown);
};
}, [key, callback]);
}, [handleKeyDown]);
};
exports.default = useKeyboard;
//# sourceMappingURL=index.js.map
{
"name": "react-mkx-toolkit",
"version": "1.7.6",
"version": "1.7.7",
"description": "React Custom Hooks provide an efficient means to encapsulate and share logic among components within React applications. This package includes useful React custom hooks.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -6,6 +6,6 @@ import { useEffect, useState } from "react";

* Represents a location object.
* @typedef {Object} Location
* @interface
* @property {number} latitude - The latitude coordinate.
* @property {number} longitude - The longitude coordinate.
* @property {Object} address - Address information associated with the location.
* @property {object} address - Address information associated with the location.
* @property {string} display_name - A human-readable representation of the location.

@@ -42,7 +42,3 @@ * @example

/**
* A hook to retrieve the current location of the user.
* @returns {Location} The current location if available, otherwise null.
*/
const useCurrentLocation = () => {
const useCurrentLocation = (): Location => {
const [location, setLocation] = useState<Location>({

@@ -55,3 +51,3 @@ latitude: 0,

const { latitude, longitude, address, display_name } = location;
const { latitude, longitude, address, display_name }: Location = location;

@@ -64,3 +60,3 @@ useEffect(() => {

*/
const getCurrentLocation = async () => {
const getCurrentLocation = async (): Promise<void> => {
try {

@@ -70,3 +66,3 @@ if (!("geolocation" in navigator)) {

}
const position: GeolocationPosition = await new Promise(
const position = await new Promise<GeolocationPosition>(
(resolve, reject) => {

@@ -73,0 +69,0 @@ navigator.geolocation.getCurrentPosition(resolve, reject);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc