pendingManager.js 383 B

12345678910111213141516171819202122
  1. let pendingList = []
  2. export class PendingManager {
  3. constructor() {
  4. this.isRefreshing = false
  5. }
  6. /**
  7. * 添加一个请求到等待队列中
  8. */
  9. addPending(callback) {
  10. pendingList.push(callback)
  11. }
  12. /**
  13. * 执行等待中的所有请求,清空队列
  14. */
  15. removeAllPending() {
  16. pendingList.forEach((callback) => callback())
  17. pendingList = []
  18. }
  19. }