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

@react-hook/event

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/event - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

10

dist/main/index.js

@@ -8,6 +8,2 @@ "use strict";

var _passiveLayoutEffect = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@react-hook/passive-layout-effect"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -20,7 +16,7 @@

const storedCleanup = React.useRef(cleanup);
(0, _passiveLayoutEffect.default)(() => {
React.useEffect(() => {
storedListener.current = listener;
storedCleanup.current = cleanup;
});
(0, _passiveLayoutEffect.default)(() => {
React.useEffect(() => {
const targetEl = target && 'current' in target ? target.current : target;

@@ -32,3 +28,3 @@ if (!targetEl) return;

if (didUnsubscribe) return;
storedListener.current(this, args);
storedListener.current.apply(this, args);
}

@@ -35,0 +31,0 @@

import * as React from 'react';
import useLayoutEffect from '@react-hook/passive-layout-effect';

@@ -7,7 +6,7 @@ function useEvent(target, type, listener, cleanup) {

const storedCleanup = React.useRef(cleanup);
useLayoutEffect(() => {
React.useEffect(() => {
storedListener.current = listener;
storedCleanup.current = cleanup;
});
useLayoutEffect(() => {
React.useEffect(() => {
const targetEl = target && 'current' in target ? target.current : target;

@@ -19,3 +18,3 @@ if (!targetEl) return;

if (didUnsubscribe) return;
storedListener.current(this, args);
storedListener.current.apply(this, args);
}

@@ -22,0 +21,0 @@

@@ -7,14 +7,10 @@ (function (global, factory) {

var React__default = 'default' in React ? React['default'] : React;
var usePassiveLayoutEffect = React__default[typeof document !== 'undefined' && document.createElement !== void 0 ? 'useLayoutEffect' : 'useEffect'];
function useEvent(target, type, listener, cleanup) {
var storedListener = React.useRef(listener);
var storedCleanup = React.useRef(cleanup);
usePassiveLayoutEffect(function () {
React.useEffect(function () {
storedListener.current = listener;
storedCleanup.current = cleanup;
});
usePassiveLayoutEffect(function () {
React.useEffect(function () {
var targetEl = target && 'current' in target ? target.current : target;

@@ -31,3 +27,3 @@ if (!targetEl) return;

storedListener.current(this, args);
storedListener.current.apply(this, args);
}

@@ -34,0 +30,0 @@

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).useEvent=t(e.React)}(this,(function(e){"use strict";var t=("default"in e?e.default:e)["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"];return function(n,r,u,f){var c=e.useRef(u),i=e.useRef(f);t((function(){c.current=u,i.current=f})),t((function(){function e(){if(!u){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];c.current(this,t)}}var t=n&&"current"in n?n.current:n;if(t){var u=0;t.addEventListener(r,e);var f=i.current;return function(){u=1,t.removeEventListener(r,e),f&&f()}}}),[n,r])}}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e=e||self).useEvent=n(e.React)}(this,(function(e){"use strict";return function(n,t,r,u){var f=e.useRef(r),c=e.useRef(u);e.useEffect((function(){f.current=r,c.current=u})),e.useEffect((function(){function e(){if(!u){for(var e=arguments.length,n=new Array(e),t=0;e>t;t++)n[t]=arguments[t];f.current.apply(this,n)}}var r=n&&"current"in n?n.current:n;if(r){var u=0;r.addEventListener(t,e);var i=c.current;return function(){u=1,r.removeEventListener(t,e),i&&i()}}}),[n,t])}}));
//# sourceMappingURL=use-event.js.map
{
"name": "@react-hook/event",
"version": "1.2.5",
"version": "1.2.6",
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/event#readme",

@@ -129,5 +129,3 @@ "repository": "github:jaredLunde/react-hook",

},
"dependencies": {
"@react-hook/passive-layout-effect": "^1.2.1"
},
"dependencies": {},
"peerDependencies": {

@@ -134,0 +132,0 @@ "react": ">=16.8"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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