logo
  • 教程列表
  • SO官方文檔
  • 非同步等待
    • 使用 Try-Catch 錯誤處理的非同步函式
    • Promises 和 AsyncAwait 之間的比較
    • 來自回撥的進展
    • 停止執行等待
  1. StackOverflow 文件
  2. Node.js 教程
  3. 非同步等待
  4. 停止執行等待

停止執行等待

Created: November-22, 2018

如果 promise 沒有返回任何內容,則可以使用 await 完成非同步任務。

try{
    await User.findByIdAndUpdate(user._id, {
        $push: {
            tokens: token
        }
    }).exec()
}catch(e){
    handleError(e)
}
  • 來自回撥的進展

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明