Is it possible to “buffer” DOM changes that happen in a loop (to increase performance)?

前端 未结 5 2031
轻奢々
轻奢々 2021-01-06 10:50

To make it clear what I\'m asking, here is my example (fiddle).

I have a list of ~500 random names. I have an input at the top that has live-style searching. On ever

5条回答
  •  情深已故
    2021-01-06 10:56

    Why not use a debounce function from underscore to limit the number of calls to get new data? I generally use 3-400 ms delay for search input fields. This will reduce the number of times that the dom has changes and will also prevent the flashing of search results if the user is a slow typist.

    Find details of debounce here

提交回复
热议问题