Wait is aparticular function when interpreter is entering in it flag the main block code . When is exiting unflag the block code. The main black code is blocked until the flag is unabled. No particular template or complex structure in js not very usable but a simple signal/wait.
Wait (function)
It is similar but I don’t understand for what reason add async when the interpreter can understand automatically when inside is used await
Blocking the main thread blocks the entire tab (in browsers). The user cannot interact with the tab at all. This is usually not what you want to happen.
Actually, it can block multiple tabs, if they are related, like window.open
for the same origin. And in browser implementations of multiple-process-user-agents, it may block unrelated tabs that happen to share the same process.
This is pretty harmful.
no you dont undertand. it works also await function. But ASYNC is absololutely useless. ASYNC keywork is USELESS.
Your reply is really unclear to me, sorry. I do not understand what you are trying to convey.
I write simply that functional logic is the same . it is a wait, it wait for a async result. But is the way to implement it that is wrong. Actually is use async keyword wrapping … but why? for realizing a so native function based on all OS you use complex adt as templates, … it is a simple wait!!!
No async keyword is necessary in the code. Why add that keyword confusing developers for no real need? Sincerelly i dont understand if who design new html5 proposals is a developer and a sotware architect or just a functional analizer. it seams the second one.
I am still not sure I understand…
async
and await
are just syntactic sugar for promise usage.
What exactly are you proposing here?
Can you include some sample code for your proposal (and not just Wait()
)?
The async
keyword indicates that the function automatically returns a promise. It also provides backward compatibility, as someone could have created an await
function before async/await which would break when await
support was added.
Also, HTML5 is unrelated to async/await. ECMAScript is the language standard.
it is necessary to add a keyword for granting function returns a promise. For a language not typized ? boh Ok now i know who is responsable for async keyword that i hate ecmascript not html5
bohhh, ok it create automatically a promise for a code not async as a main.
No, it is not necessary to use async to return a promise, it is syntactic sugar to do so easier. These two functions both return a promise.
async function() { }
function() {
return(new Promise(function(){
}))
}