use-subscription
Advanced tools
Comparing version 0.0.0-experimental-0ba4698c7-20230201 to 0.0.0-experimental-0bc30748-20241028
@@ -11,42 +11,17 @@ /** | ||
'use strict'; | ||
if (process.env.NODE_ENV !== "production") { | ||
(function() { | ||
'use strict'; | ||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ | ||
if ( | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === | ||
'function' | ||
) { | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); | ||
} | ||
var shim = require('use-sync-external-store/shim'); | ||
// | ||
// In order to avoid removing and re-adding subscriptions each time this hook is called, | ||
// the parameters passed to this hook should be memoized in some way– | ||
// either by wrapping the entire params object with useMemo() | ||
// or by wrapping the individual callbacks with useCallback(). | ||
function useSubscription(_ref) { | ||
var getCurrentValue = _ref.getCurrentValue, | ||
subscribe = _ref.subscribe; | ||
return shim.useSyncExternalStore(subscribe, getCurrentValue); | ||
} | ||
exports.useSubscription = useSubscription; | ||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ | ||
if ( | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === | ||
'function' | ||
) { | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
} | ||
"use strict"; | ||
"production" !== process.env.NODE_ENV && | ||
(function () { | ||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && | ||
"function" === | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | ||
var shim = require("use-sync-external-store/shim"); | ||
exports.useSubscription = function (_ref) { | ||
return shim.useSyncExternalStore(_ref.subscribe, _ref.getCurrentValue); | ||
}; | ||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && | ||
"function" === | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | ||
})(); | ||
} |
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/use-subscription.production.min.js'); | ||
module.exports = require('./cjs/use-subscription.production.js'); | ||
} else { | ||
module.exports = require('./cjs/use-subscription.development.js'); | ||
} |
{ | ||
"name": "use-subscription", | ||
"description": "Reusable hooks", | ||
"version": "0.0.0-experimental-0ba4698c7-20230201", | ||
"version": "0.0.0-experimental-0bc30748-20241028", | ||
"repository": { | ||
@@ -18,3 +18,3 @@ "type": "git", | ||
"peerDependencies": { | ||
"react": "0.0.0-experimental-0ba4698c7-20230201" | ||
"react": "0.0.0-experimental-0bc30748-20241028" | ||
}, | ||
@@ -25,4 +25,4 @@ "devDependencies": { | ||
"dependencies": { | ||
"use-sync-external-store": "0.0.0-experimental-0ba4698c7-20230201" | ||
"use-sync-external-store": "0.0.0-experimental-0bc30748-20241028" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # use-subscription | ||
**You may now migrate to [`use-sync-external-store`](https://www.npmjs.com/package/use-sync-external-store) directly instead, which has the same API as [`React.useSyncExternalStore`](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore). The `use-subscription` package is now a thin wrapper over `use-sync-external-store` and will not be updated further.** | ||
**You may now migrate to [`use-sync-external-store`](https://www.npmjs.com/package/use-sync-external-store) directly instead, which has the same API as [`React.useSyncExternalStore`](https://react.dev/reference/react/useSyncExternalStore). The `use-subscription` package is now a thin wrapper over `use-sync-external-store` and will not be updated further.** | ||
@@ -8,0 +8,0 @@ # Installation |
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
6837
45
+ Addedreact@0.0.0-experimental-0bc30748-20241028(transitive)
+ Addeduse-sync-external-store@0.0.0-experimental-0bc30748-20241028(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedreact@0.0.0-experimental-0ba4698c7-20230201(transitive)
- Removeduse-sync-external-store@0.0.0-experimental-0ba4698c7-20230201(transitive)
Updateduse-sync-external-store@0.0.0-experimental-0bc30748-20241028