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

util-hooks

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

util-hooks

a library for some react hooks

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

util-hooks

a library for some react hooks

docs

polling hook


import { useInertval } from 'util-hooks'

useInertval(async () => {
  if (xxx) {
    const res = await getData()
    if (loadOk(res.status)) {
      /** return `false` or `Promise.reject` will stop polling */
      /** 返回 `false` 或者 `Promise.reject` 将会停止下一次轮询 */
      return false
    }
  }
  return true
}, 3000)

useInertval(async () => {
    const res = await getData()
    if (loadOk(res.status)) {
      /** return `false` or `Promise.reject` will stop polling */
      /** 返回 `false` 或者 `Promise.reject` 将会停止下一次轮询 */
      return false
    }
  /** return a number will telling the next poling delay */
  /** 返回一个数字将会是下一个轮询的延迟时间 */
  return 1000
}, 3000)


Keywords

utils

FAQs

Package last updated on 18 May 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