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

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.

主站蜘蛛池模板: 乳源| 神木县| 三门县| 盐亭县| 恭城| 绩溪县| 贵州省| 休宁县| 河源市| 陇川县| 鸡东县| 新野县| 县级市| 邵武市| 成都市| 会东县| 彰化市| 铁岭县| 右玉县| 锡林郭勒盟| 永寿县| 龙海市| 通州市| 赤峰市| 唐山市| 凉城县| 贡觉县| 镇康县| 金溪县| 溧阳市| 和田县| 遂平县| 准格尔旗| 新竹市| 新兴县| 咸宁市| 句容市| 铁岭县| 三亚市| 丹阳市| 盐池县|