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

@gmana/react-go-top

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gmana/react-go-top - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

34

go-top.esm.js

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

import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';

@@ -11,18 +11,26 @@ var GoTop = function GoTop(_a) {

var checkScrollTop = function checkScrollTop() {
if (!show && window.pageYOffset > startShow) {
setShow(true);
} else if (show && window.pageYOffset <= startShow) {
setShow(false);
}
};
useEffect(function () {
var checkScrollTop = function checkScrollTop() {
if (!show && window.pageYOffset > startShow) {
setShow(true);
} else if (show && window.pageYOffset <= startShow) {
setShow(false);
}
};
window.addEventListener('scroll', checkScrollTop);
return function cleanup() {
window.removeEventListener('scroll', checkScrollTop);
};
}, [show, startShow]);
var scrollTop = function scrollTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
if (typeof window !== "undefined") {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
};
window.addEventListener('scroll', checkScrollTop);
return show && React.createElement("div", {

@@ -29,0 +37,0 @@ className: 'gmana-go-top',

@@ -17,18 +17,26 @@ (function (global, factory) {

var checkScrollTop = function checkScrollTop() {
if (!show && window.pageYOffset > startShow) {
setShow(true);
} else if (show && window.pageYOffset <= startShow) {
setShow(false);
}
};
React.useEffect(function () {
var checkScrollTop = function checkScrollTop() {
if (!show && window.pageYOffset > startShow) {
setShow(true);
} else if (show && window.pageYOffset <= startShow) {
setShow(false);
}
};
window.addEventListener('scroll', checkScrollTop);
return function cleanup() {
window.removeEventListener('scroll', checkScrollTop);
};
}, [show, startShow]);
var scrollTop = function scrollTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
if (typeof window !== "undefined") {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
};
window.addEventListener('scroll', checkScrollTop);
return show && React__default.createElement("div", {

@@ -35,0 +43,0 @@ className: 'gmana-go-top',

{
"name": "@gmana/react-go-top",
"version": "0.0.5",
"version": "0.0.6",
"author": {

@@ -5,0 +5,0 @@ "name": "Sun Sreng",

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