Here's an example of async function :
js |
---|
async function foo() { // todo } |
Sometimes I prefer to call it without the blocking. but in this case I wouldn't know if this was an async function.
js |
---|
// is this async function? foo(); |
I've recently worked on C# project and so I though a task prefix would be useful for async function naming in JavaScript.
js |
---|
async function taskFoo() { // todo } taskFoo(); |
This way I know in a glance that this is an async function and use await if needed.
js |
---|
// don't need to use await taskFoo(); // need to use await await taskFoo(); |
Improving from Here
The next approach groups the async functions definitions and remove the "Task-" prefix to improve first letter search.
https://vanillawebdev.blogspot.com/2023/09/naming-the-async-function-part-1.html https://www.blogger.com/blog/post/edit/8166404610182826392/6368475674561478917 https://www.blogger.com/blog/page/edit/8166404610182826392/6368475674561478917Naming The Async Function - Part 1
Here's an example of async function :
js |
---|
async function foo() { // todo } |
Sometimes I prefer to call it without the blocking. but in this case I wouldn't know if this was an async function.
js |
---|
// is this async function? foo(); |
I've recently worked on C# project and so I though a task prefix would be useful for async function naming in JavaScript.
js |
---|
async function taskFoo() { // todo } taskFoo(); |
This way I know in a glance that this is an async function and use await if needed.
js |
---|
// don't need to use await taskFoo(); // need to use await await taskFoo(); |
Improving from Here
The next approach groups the async functions definitions and remove the "Task-" prefix to improve first letter search.
Comments
Post a Comment