Advertisement
pharmokan

imgur thoughts

Apr 10th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. n = 50
  2. getPage || 1
  3. id = getId || null
  4. getIdIndex || 0
  5.  
  6. LastSyncPoint = getPage * 50 + getIdIndex
  7. api request /page/getPage[getIndex] ? inSync = true : inSync = false
  8.  
  9. offset = find(id)
  10.  
  11. find = getPage && getPage -1 && getPage + 1
  12. if getPage == currPage
  13. offset = indexOf currPage[id] - index Of getPage[id]
  14. ==========
  15. add to db keep adding
  16. 1 table filled out
  17. 1 table from api
  18. page stopped at
  19. preload
  20. 10 image thumbnails
  21.  
  22. page1[0]
  23. page2[0]
  24. offset = where is page1[0].id now? page2? page3? keep going till you find it.
  25.  
  26. while you doing that filter out which ids already filled out
  27.  
  28.  
  29. always check page 1
  30. page1[0] page1[49]
  31. last.page1[0] == curr.page1[0]?
  32. if yes, continue where you left off
  33. else
  34. offset = id.indexOf(curr.page1[i])
  35.  
  36.  
  37. 1
  38. ---
  39. 1
  40. 2
  41. 3
  42. 4x
  43. ..
  44. 50x
  45.  
  46. 2
  47. ---
  48. 51x
  49. 52x <--here
  50. ..
  51. 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement