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

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.

主站蜘蛛池模板: 民县| 奈曼旗| 封开县| 镇坪县| 枞阳县| 叶城县| 礼泉县| 田林县| 利川市| 德江县| 上饶市| 平昌县| 永州市| 莎车县| 上饶县| 苗栗县| 宝鸡市| 五华县| 海淀区| 上饶县| 利津县| 台前县| 交城县| 贡山| 新宾| 呈贡县| 双牌县| 财经| 大理市| 湘阴县| 长沙市| 阿拉善右旗| 岑溪市| 大丰市| 晋城| 苏州市| 赤水市| 赤壁市| 江永县| 锦屏县| 封开县|