Job and Deferred

We can divide our asynchronous functions into two groups:

  • Those without a result. Common scenarios are background tasks that write to a log, send analytics, and similar tasks. This type can include background tasks that may be monitored for completion but that don't have a result.
  • Those that return a result. For example, if an asynchronous function is fetching information from a web service, you will most likely want to have that function return that information in order to use it.

In both cases, you will still want to have access to the task and react if there is an exception or cancel them if their work is not required anymore. Let's take a look at how we can create and interact with both types.

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

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