maxtaco / tamejs

JavaScript code rewriter for taming async-callback-style code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idea: await without defer

lanwin opened this issue · comments

In node there is the convention that callbacks should be the last parameter of an function.

with that in mind, it would be possible to create a short await which translates:

await { foo.bar(100,defer ()); }

to:

await foo.bar(100);

It would think that it is also possible to detect which variables are used behind the await and pass them automatically to defer. That would make the whole pattern a lot more readable.

But what it someone wants to use it in his non-node jQuery app?

$.get('foo', defer(var response), 'json');