Promise的使用

什麼是promise,哪些應用場景 承諾,是異步編程的一種解決方案.所謂Promise,它自己就是一個容器,裏面保存着異步操做的結果,它有三種狀態:html pending(進行中) resolved(成功) rejected(失敗 Promise.all() //實現當全部的圖片所有加載完畢,才顯示在頁面中 Promise.race() //實現誰先加載完畢就顯示誰 獲取容器結果:.then()
相關文章
相關標籤/搜索