@restart/hooks
Advanced tools
Comparing version 0.3.21 to 0.3.22
@@ -1,2 +0,2 @@ | ||
import { DependencyList } from 'react'; | ||
import { DependencyList, EffectCallback } from 'react'; | ||
/** | ||
@@ -18,3 +18,3 @@ * An _immediate_ effect that runs an effect callback when its dependency array | ||
*/ | ||
declare function useImmediateUpdateEffect(effect: () => void, deps: DependencyList): void; | ||
declare function useImmediateUpdateEffect(effect: EffectCallback, deps: DependencyList): void; | ||
export default useImmediateUpdateEffect; |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _useWillUnmount = _interopRequireDefault(require("./useWillUnmount")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,2 +33,6 @@ | ||
var firstRef = (0, _react.useRef)(true); | ||
var tearDown = (0, _react.useRef)(); | ||
(0, _useWillUnmount.default)(function () { | ||
if (tearDown.current) tearDown.current(); | ||
}); | ||
(0, _useStableMemo.default)(function () { | ||
@@ -38,3 +44,4 @@ if (firstRef.current) { | ||
effect(); | ||
if (tearDown.current) tearDown.current(); | ||
tearDown.current = effect(); | ||
}, deps); | ||
@@ -41,0 +48,0 @@ } |
@@ -64,3 +64,5 @@ "use strict"; | ||
return ObservableMap; | ||
}(_wrapNativeSuper(Map)); | ||
}( | ||
/*#__PURE__*/ | ||
_wrapNativeSuper(Map)); | ||
/** | ||
@@ -67,0 +69,0 @@ * Create and return a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) that triggers rerenders when it's updated. |
@@ -64,3 +64,5 @@ "use strict"; | ||
return ObservableSet; | ||
}(_wrapNativeSuper(Set)); | ||
}( | ||
/*#__PURE__*/ | ||
_wrapNativeSuper(Set)); | ||
/** | ||
@@ -67,0 +69,0 @@ * Create and return a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that triggers rerenders when it's updated. |
@@ -1,2 +0,2 @@ | ||
import { DependencyList } from 'react'; | ||
import { DependencyList, EffectCallback } from 'react'; | ||
/** | ||
@@ -18,3 +18,3 @@ * An _immediate_ effect that runs an effect callback when its dependency array | ||
*/ | ||
declare function useImmediateUpdateEffect(effect: () => void, deps: DependencyList): void; | ||
declare function useImmediateUpdateEffect(effect: EffectCallback, deps: DependencyList): void; | ||
export default useImmediateUpdateEffect; |
import { useRef } from 'react'; | ||
import useStableMemo from './useStableMemo'; | ||
import useWillUnmount from './useWillUnmount'; | ||
/** | ||
@@ -22,2 +23,6 @@ * An _immediate_ effect that runs an effect callback when its dependency array | ||
var firstRef = useRef(true); | ||
var tearDown = useRef(); | ||
useWillUnmount(function () { | ||
if (tearDown.current) tearDown.current(); | ||
}); | ||
useStableMemo(function () { | ||
@@ -29,3 +34,4 @@ if (firstRef.current) { | ||
effect(); | ||
if (tearDown.current) tearDown.current(); | ||
tearDown.current = effect(); | ||
}, deps); | ||
@@ -32,0 +38,0 @@ } |
@@ -55,3 +55,5 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
return ObservableMap; | ||
}(_wrapNativeSuper(Map)); | ||
}( | ||
/*#__PURE__*/ | ||
_wrapNativeSuper(Map)); | ||
/** | ||
@@ -58,0 +60,0 @@ * Create and return a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) that triggers rerenders when it's updated. |
@@ -55,3 +55,5 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
return ObservableSet; | ||
}(_wrapNativeSuper(Set)); | ||
}( | ||
/*#__PURE__*/ | ||
_wrapNativeSuper(Set)); | ||
/** | ||
@@ -58,0 +60,0 @@ * Create and return a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that triggers rerenders when it's updated. |
{ | ||
"name": "@restart/hooks", | ||
"version": "0.3.21", | ||
"version": "0.3.22", | ||
"main": "cjs/index.js", | ||
@@ -41,4 +41,8 @@ "types": "cjs/index.d.ts", | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.17.15", | ||
"lodash-es": "^4.17.15" | ||
}, | ||
"readme": "ERROR: No README data found!", | ||
"_id": "@restart/hooks@0.3.20" | ||
"_id": "@restart/hooks@0.3.21" | ||
} |
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
156565
184
4185
3
+ Addedlodash@^4.17.15
+ Addedlodash-es@^4.17.15
+ Addedlodash@4.17.21(transitive)
+ Addedlodash-es@4.17.21(transitive)