Skip to content

Instantly share code, notes, and snippets.

@jrosell
Created July 5, 2022 13:00
Show Gist options
  • Save jrosell/a222ad69e2cc9d6ac6c46a295eb9c4e1 to your computer and use it in GitHub Desktop.
Save jrosell/a222ad69e2cc9d6ac6c46a295eb9c4e1 to your computer and use it in GitHub Desktop.
I currently have a tag that has a single trigger that is activated as many times as attributes need to be managed. I would like to add another tag that should be activated at the end, once the previous attributes have been processed by the initial tag.
<html><body>
<script>
function handle() {
console.log("handle")
window.myPolling = setTimeout(finish, 2000);
}
function finish() {
console.log("finish")
}
function fireAttribute(){
clearTimeout(window.myPolling);
handle()
}
window.addEventListener('DOMContentLoaded', (event) => {
setTimeout(fireAttribute, 1000)
setTimeout(fireAttribute, 2000)
setTimeout(fireAttribute, 3000)
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment