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

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.

主站蜘蛛池模板: 安龙县| 镇雄县| 深州市| 邯郸县| 闽侯县| 甘洛县| 靖州| 玛纳斯县| 侯马市| 昭苏县| 兴宁市| 顺昌县| 临夏市| 陆丰市| 丰台区| 温泉县| 辽阳县| 永善县| 江阴市| 康乐县| 辉南县| 平昌县| 吉木萨尔县| 碌曲县| 云林县| 盐山县| 额济纳旗| 郴州市| 盐源县| 惠来县| 延安市| 彰化县| 兰坪| 同江市| 保山市| 莱阳市| 黑河市| 屯留县| 肥城市| 梁平县| 邛崃市|