Spinner

A spinner (or other simple activity indicator) can be a helpful visualization of whether or not there's background activity. It'll be visible if the number of background tasks is non-zero. To track this, we can implement a simple counter in the application and update it using the StartTask() and StopTask() functions. A listener or channel would then tell the user interface element that the number of running tasks had changed so it can update the GUI by showing or hiding the visual element.

In a cloud-based application where a background task is using network connections, there's an added benefit: we can insert these task tracking function calls into the network request code. For example, we could update readStream() to call StartTask() and all of the background tasks will increment the counter. To signal that the task had ended, we would return a wrapper to the stream so that, when Close() is called, it can correctly call StopTask().

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.105.159