Asynchronous programming is a technique that enables your program to start a potentially long-running task and still be able to be responsive to other events while that task runs, rather than having to wait until that task has finished. Once that task has finished, your program is presented with the result.
Many functions provided by browsers, especially the most interesting ones, can potentially take a long time, and therefore, are asynchronous.
Front-end developers have several low-level techniques available that allow for managing these long-running tasks without starving the main UI thread including:
-
Callbacks
-
Promises
-
async/await
In KOS, unlike traditional web applications, almost every action is asynchronous in that most tasks are long-running and most don’t follow a familiar request/response execution pattern. In many cases, a given operation can be composed of multiple child operations with a full graph of potential operations that are assembled dynamically while the operation is in progress.
-
need to address the cases where the full graph of work to be performed is indeterminate when the action is first executed.
-
also doesn’t cleanly support incremental progress updates, especially when the full scope of the operation is dynamically composed at execution time.
-
KOS provides a robust async capability (Future Work) in which complex operations can be performed while returning a work item to the UI that appears as a trackable operation with concepts of completed progress and time remaining.
-
The UI SDK ensures that any operation initiated from the front end that returns a Future Work will automatically create a Work Model that will register for any updates and report them back to the consuming application.
-
The Work model will ensure that common concepts such as the current work item (step), estimated time remaining and total progress are kept up to date while managing any additional client data that might accompany the work updates.