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) {
}
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
import liveCheck from 'live-check'
liveCheck(()=> {
document.querySelector(".username")
},{
checkTimes: 10,
checkInterval: 1*500
}).then(()=>{
}).catch(()=>{
})
Options
| checkTimes | number | 500 | live query check condition times |
| checkInterval | number | 50(ms) | live query check one time interval |