Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@restart/hooks

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restart/hooks - npm Package Compare versions

Comparing version 0.2.11 to 0.2.12

6

es/useFocusManager.d.ts

@@ -7,11 +7,11 @@ /// <reference types="react" />

*/
willHandle(focused: boolean, event: React.FocusEvent): boolean | void;
willHandle?(focused: boolean, event: React.FocusEvent): boolean | void;
/**
* A callback fired after focus is handled but before onChange is called
*/
didHandle(focused: boolean, event: React.FocusEvent): void;
didHandle?(focused: boolean, event: React.FocusEvent): void;
/**
* A callback fired after focus has changed
*/
onChange(focused: boolean, event: React.FocusEvent): void;
onChange?(focused: boolean, event: React.FocusEvent): void;
/**

@@ -18,0 +18,0 @@ * When true, the event handlers will not report focus changes

@@ -7,3 +7,16 @@ /**

* @returns a function that returns the current isMounted state of the component
*
* ```ts
* const [data, setData] = useState(null)
* const isMounted = useMounted()
*
* useEffect(() => {
* fetchdata().then((newData) => {
* if (isMounted()) {
* setData(newData);
* }
* })
* })
* ```
*/
export default function useMounted(): () => boolean;

@@ -14,5 +14,21 @@ "use strict";

* @returns a function that returns the current isMounted state of the component
*
* ```ts
* const [data, setData] = useState(null)
* const isMounted = useMounted()
*
* useEffect(() => {
* fetchdata().then((newData) => {
* if (isMounted()) {
* setData(newData);
* }
* })
* })
* ```
*/
function useMounted() {
var mounted = (0, _react.useRef)(true);
var isMounted = (0, _react.useRef)(function () {
return mounted.current;
});
(0, _react.useEffect)(function () {

@@ -23,5 +39,3 @@ return function () {

}, []);
return function () {
return mounted.current;
};
return isMounted.current;
}
{
"name": "@restart/hooks",
"version": "0.2.11",
"version": "0.2.12",
"main": "index.js",

@@ -5,0 +5,0 @@ "types": "index.d.ts",

@@ -7,11 +7,11 @@ /// <reference types="react" />

*/
willHandle(focused: boolean, event: React.FocusEvent): boolean | void;
willHandle?(focused: boolean, event: React.FocusEvent): boolean | void;
/**
* A callback fired after focus is handled but before onChange is called
*/
didHandle(focused: boolean, event: React.FocusEvent): void;
didHandle?(focused: boolean, event: React.FocusEvent): void;
/**
* A callback fired after focus has changed
*/
onChange(focused: boolean, event: React.FocusEvent): void;
onChange?(focused: boolean, event: React.FocusEvent): void;
/**

@@ -18,0 +18,0 @@ * When true, the event handlers will not report focus changes

@@ -7,3 +7,16 @@ /**

* @returns a function that returns the current isMounted state of the component
*
* ```ts
* const [data, setData] = useState(null)
* const isMounted = useMounted()
*
* useEffect(() => {
* fetchdata().then((newData) => {
* if (isMounted()) {
* setData(newData);
* }
* })
* })
* ```
*/
export default function useMounted(): () => boolean;

@@ -14,5 +14,21 @@ "use strict";

* @returns a function that returns the current isMounted state of the component
*
* ```ts
* const [data, setData] = useState(null)
* const isMounted = useMounted()
*
* useEffect(() => {
* fetchdata().then((newData) => {
* if (isMounted()) {
* setData(newData);
* }
* })
* })
* ```
*/
function useMounted() {
var mounted = (0, _react.useRef)(true);
var isMounted = (0, _react.useRef)(function () {
return mounted.current;
});
(0, _react.useEffect)(function () {

@@ -23,5 +39,3 @@ return function () {

}, []);
return function () {
return mounted.current;
};
return isMounted.current;
}
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