官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 临泉县| 厦门市| 商洛市| 遂平县| 宜兰县| 孙吴县| 巩义市| 奉贤区| 伊川县| 郑州市| 灵宝市| 鲜城| 赣榆县| 锡林浩特市| 上林县| 岚皋县| 电白县| 时尚| 来凤县| 亳州市| 徐水县| 鄯善县| 翁源县| 扬州市| 齐齐哈尔市| 惠东县| 白朗县| 海丰县| 普兰店市| 朝阳区| 怀远县| 柘城县| 石台县| 四会市| 沈丘县| 长葛市| 桂阳县| 肥西县| 东宁县| 布尔津县| 贺州市|