Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback function delays to execute #350

Open
coucoseth opened this issue Sep 26, 2023 · 1 comment
Open

callback function delays to execute #350

coucoseth opened this issue Sep 26, 2023 · 1 comment

Comments

@coucoseth
Copy link

QRCode.toDataURL(dataForQRCode)
.then(url => {
 console.log(url)
})
.catch(err => {
     console.error('qrcode error', err)
 })
 // other piece of code

The other piece of code gets executed before the callback of QRCode . How can i make sure it executes only after the qrcode url is returned

@joshxyzhimself
Copy link

(async () => {
  try {
    const url = await QRCode.toDataURL(dataForQRCode);
    // other piece of code
  } catch (e) {
    console.error(e);
  }
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants