loading...

Qt Timer JS Events

jsmitar profile image JSmith AR ・1 min read

hello this is my first post.
I want to share an extension for Qt5 that mimics the JS Timer Events. QtTimerJS

Enjoy it :)

  import QtQuick 2.0
  import org.jsmitar.timerjs 1.0

  Item {
    function foo() {
      let timer = setTimeout(_ => console.log('HELLO timer'), 100)
      clearTimeout(timer)
      clearTimeout(timer) // is safe call clearTimeout multiple times
    }

    function bar() {
      let timer = setInterval(_ => {
        console.log('HELLO timer')
        clearInterval(timer) // you can use clearTimeout too
      }, 100)
    }
  }

Discussion

markdown guide