# Compiler plugin adapted for JS target? (async, await)

**URL:** <https://community.haxe.org/t/compiler-plugin-adapted-for-js-target-async-await/3031>\
**Category:** Haxe\
**Tags:** haxe-js, compiler-plugin\
**Created:** [May 12, 2021, 1:51pm UTC](https://community.haxe.org/t/compiler-plugin-adapted-for-js-target-async-await/3031 "2021-05-12T13:51:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cambiata](https://community.haxe.org/user_avatar/community.haxe.org/cambiata/32/61_2.png) [@cambiata](https://community.haxe.org/u/cambiata)\
**Post date:** [May 12, 2021, 1:51pm UTC](https://community.haxe.org/t/compiler-plugin-adapted-for-js-target-async-await/3031/1 "2021-05-12T13:51:41Z")

</div>

Right now, I’m doing almost nothing but JS development with Haxe, and in spite that haxelibs like [jsasync (1.2.1)](https://lib.haxe.org/p/jsasync/) and [hxasync (1.1.0)](https://lib.haxe.org/p/hxasync/) do a great job for macrowise making it possible to use `async` and `await`, they are workarounds with limitations.

Re-saw Aleksandr’s “Plugins for the Haxe Compiler” the other day ([https://www.youtube.com/watch?v=4Iy1\_HcMuIk](https://www.youtube.com/watch?v=4Iy1_HcMuIk)), wich got me thinking…  
Would it be possible - through a compiler plugin - to extend the compiler JS target to handle the async/await keywords 1:1 (or almost) to how they work in native JS?

This would of course not work for other targets, and it would of course require me to build my own compiler. But that would be a cheap price, I think. And of course, it will soon be redundant, replaced by the native fancy cross-target Haxe concurrency solution we’re all waiting for… 🙂

In the meantime, would a JS-specific compiler like this plugin be possible?

(It wouldn’t hurt if it at the same time could cope with object destructuring and some other nice modern js features :-), but async/await for sure are at the top of my list and would be good enough).

---

<div class="post-metadata">

**Author:** ![RealyUniqueName](https://community.haxe.org/user_avatar/community.haxe.org/realyuniquename/32/10_2.png) [@RealyUniqueName](https://community.haxe.org/u/RealyUniqueName)\
**Post date:** [May 12, 2021, 2:11pm UTC](https://community.haxe.org/t/compiler-plugin-adapted-for-js-target-async-await/3031/2 "2021-05-12T14:11:59Z")

</div>

Plugins don’t allow to alter Haxe syntax or add new keywords.

---

<div class="post-metadata">

**Author:** ![cambiata](https://community.haxe.org/user_avatar/community.haxe.org/cambiata/32/61_2.png) [@cambiata](https://community.haxe.org/u/cambiata)\
**Post date:** [May 12, 2021, 5:38pm UTC](https://community.haxe.org/t/compiler-plugin-adapted-for-js-target-async-await/3031/3 "2021-05-12T17:38:10Z")

</div>

Ah, I see. Thanks, Aleksandr!
