simple await/async help

  • I’m trying to wrap my head around how to use await/async in a template.

    The end result would be scraping a website and search for specific data but I’m unable to get my code to wait until a function is executed before proceeding.

    Here is some test code to help me figure out await/async:

        <q-btn label="test btn" @click="testMethod()"/>
      async function testAsync1(){
        const t = await testAsync2();
        console.log('t: ' + t);
      async function testAsync2(){
          return 'test async text';
        }, 333);
      export default {
        name: 'test',

    The result of pressing the “test btn” button should be an output in the console like this: “t: test async text” but instead I get “t: undefined”.

    Could someone please point me in the right direction with this? I would really appreciate it.


  • Ah! Thanks a lot for that link. I guess my trying to figure out away/async with setTimeout was a very bad idea.

    I really appreciate the help!

Log in to reply