3 ms·
That only because the implementation is poor. It doesn’t have to be intrusive.
by aidos 5y ago
That only because the implementation is poor. It doesn’t have to be intrusive.
- eyelidlessness 5y agoSort of. This can obviously be non-blocking and redirected to whatever stdin-ish receiver you prefer: alert('whatever'); This cannot: const answer = confirm('A querstion?'); const value = doSomethingWithUserInput(answer); return doSomethingWithValue(value); The API depends on it blocking the main thread, and removing that expectation is effectively just as disruptive as removing the feature entirely: non-abusive usage would have no reason to call this function if not to block for user input. Introducing some magical suspension of the stack like async/await or generators would break assumptions about the entire concurrent execution model of the language (the inverse problem of “colored functions”, infectious async/await etc). The best thing they can do without removing the API is provide an escape hatch, which most browsers already do when alert &co are called multiple times in quick succession.