tamejs icon indicating copy to clipboard operation
tamejs copied to clipboard

Idea: await without defer

Open lanwin opened this issue 14 years ago • 1 comments
trafficstars

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.

lanwin avatar Sep 26 '11 08:09 lanwin

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

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

ThiefMaster avatar May 26 '12 14:05 ThiefMaster