1.2.0 • Published 3 years ago

live-check v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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
1.2.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago