@superdispatch/hooks
Advanced tools
Comparing version 0.7.21 to 0.7.23
@@ -60,12 +60,2 @@ 'use strict'; | ||
function useValueObserver(value, observer) { | ||
var ref = react.useRef(value); | ||
react.useEffect(() => { | ||
if (!Object.is(value, ref.current)) { | ||
observer(ref.current); | ||
ref.current = value; | ||
} | ||
}); | ||
} | ||
function useEventHandler(handler) { | ||
@@ -111,2 +101,12 @@ var mountRef = react.useRef(false); | ||
function useValueObserver(value, observer) { | ||
var ref = react.useRef(value); | ||
react.useEffect(() => { | ||
if (!Object.is(value, ref.current)) { | ||
observer(ref.current); | ||
ref.current = value; | ||
} | ||
}); | ||
} | ||
exports.useConstant = useConstant; | ||
@@ -113,0 +113,0 @@ exports.useDeepEqualMemo = useDeepEqualMemo; |
export * from "./constant/useConstant.js"; | ||
export * from "./deep-equal-memo/useDeepEqualMemo.js"; | ||
export * from "./deep-equal-value/useDeepEqualValue.js"; | ||
export * from "./value-observer/useValueObserver.js"; | ||
export * from "./event-handler/useEventHandler.js"; | ||
export * from "./is-mounted/useIsMounted.js"; | ||
export * from "./is-mounted/useIsMounted.js"; | ||
export * from "./value-observer/useValueObserver.js"; |
@@ -9,4 +9,2 @@ import { DependencyList } from 'react'; | ||
declare function useValueObserver<T>(value: T, observer: (prev: T) => void): void; | ||
declare type EventHandler<T> = (event: T) => void; | ||
@@ -17,2 +15,4 @@ declare function useEventHandler<T>(handler: null | undefined | EventHandler<T>): EventHandler<T>; | ||
declare function useValueObserver<T>(value: T, observer: (prev: T) => void): void; | ||
export { EventHandler, useConstant, useDeepEqualMemo, useDeepEqualValue, useEventHandler, useIsMounted, useValueObserver }; |
@@ -56,12 +56,2 @@ import { useRef, useEffect, useLayoutEffect, useCallback } from 'react'; | ||
function useValueObserver(value, observer) { | ||
var ref = useRef(value); | ||
useEffect(() => { | ||
if (!Object.is(value, ref.current)) { | ||
observer(ref.current); | ||
ref.current = value; | ||
} | ||
}); | ||
} | ||
function useEventHandler(handler) { | ||
@@ -106,3 +96,13 @@ var mountRef = useRef(false); | ||
function useValueObserver(value, observer) { | ||
var ref = useRef(value); | ||
useEffect(() => { | ||
if (!Object.is(value, ref.current)) { | ||
observer(ref.current); | ||
ref.current = value; | ||
} | ||
}); | ||
} | ||
export { useConstant, useDeepEqualMemo, useDeepEqualValue, useEventHandler, useIsMounted, useValueObserver }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@superdispatch/hooks", | ||
"version": "0.7.21", | ||
"version": "0.7.23", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
23482
1