New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

spa-hooks

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spa-hooks

SPA hooks onShow onHide onPageScroll onReachBottom...

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

spa-hooks

封装了一些常用的hooks,使用原生语法,不会被框架局限;

onReady

onResize

onShow

onHide

onPageScroll

onReachBottom

pageScrollTo

持续优化与完善中...

引用

npm i spa-hooks -D
or
yarn add spa-hooks -D

使用

import { onReady, onResize, onShow, onHide, onPageScroll, onReachBottom, pageScrollTo } from 'spa-hooks'

onReady(() => {
  console.log('onReady')
})

onResize((e) => {
  console.log('onResize', e)
  // {width: 1920, height: 1228}
})

onShow(() => {
  console.log('onShow')
})


onHide(() => {
  console.log('onHide')
})

onPageScroll((e) => {
  console.log(e)
  // { scrollTop: 88 }
})

onReachBottom(() => {
  console.log('onReachBottom')
})

// 将页面滚动到目标位置
pageScrollTo({
  scrollTop: 1000,
  duration: 300
})

Keywords

onShow

FAQs

Package last updated on 31 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts