Socket
Book a DemoInstallSign in
Socket

live-check

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

live-check

easy to check if dom present or condition change to true

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

live-check

Some case we need check if some elements on the document. so we can use setInterval check this dom length property like this:

  if (dom.length) {
    // do something
  }

if dom on the document you can write your logic.

use live-check can easy to do that case.

Install

npm install live-check

//or yarn 
yarn install live-check

Your code


// Check username dom exisit on document you can do this: 

import liveCheck from 'live-check'

liveCheck(()=> {
  document.querySelector(".username")
},{
  checkTimes: 10,
  checkInterval: 1*500
}).then(()=>{
  // Now you can operation the document here or implement you bussiness logic
}).catch(()=>{
  // oops the document not exist during in 10 * 1*500 millisecond over
})

Options

optionstypedefaultdescription
checkTimesnumber500live query check condition times
checkIntervalnumber50(ms)live query check one time interval

Keywords

Live query

FAQs

Package last updated on 07 Mar 2021

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