question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to implement macro with async function inside?

See original GitHub issue
  • babel-plugin-macros version: 2.1.0
  • node version: 8.6
  • npm (or yarn) version: yarn 1.5.1

Relevant code or config

What you did:

What happened:

Reproduction repository:

https://github.com/stereobooster/lqip.macro

Problem description:

I want to implement lqip.macro. I’m not sure how to use async lqip in babel-plugin-macros, which seems to be expecting synchronous code. Am I wrong here? What is the way to work with async functions? Thanks

Suggested solution:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Zemnmezcommented, Apr 6, 2020

I’ve made @kentcdodds solution into a more generic & cleaner micro library: https://github.com/Zemnmez/do-sync

0reactions
kentcdoddscommented, Apr 6, 2020

Very cool @Zemnmez! Thank you 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use macro within implementation of trait with async functions
Here's a minimal example for using an async function in a trait: use async_trait::async_trait; macro_rules! default_f { () => { async fn f() ......
Read more >
futures-await-await-macro — async Rust library // Lib.rs
The await! macro allows blocking on a future to completion. This does not actually block the thread though, it just "blocks" the future...
Read more >
futures_macro_await::await - Rust - Docs.rs
Await a sub-future inside an #[async] function. You should pass an object implementing [ Future ] or [ StableFuture ] to this macro,...
Read more >
Using async-trait macro to have sync function inside a trait
In the above code I have two fun() variants.one is a basic fun() and other is bind to a async-trait . basic function...
Read more >
better-async-await.macro - npm
In async /await functions we often use try/catch blocks to catch errors. For example:- async function ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found