DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 968,547 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
JSmith AR
JSmith AR

Posted on

Qt Timer JS Events

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)
    }
  }

Top comments (0)

Need a better mental model for async/await?

Check out this classic DEV post on the subject.

โญ๏ธ๐ŸŽ€ JavaScript Visualized: Promises & Async/Await

async await