Knockout causing “slow running script” warning in IE

前端 未结 2 564
忘掉有多难
忘掉有多难 2020-12-21 06:14

I have a grid of observables and computed observables. The first row contains percentage rates used as a multiplier against the values in all the rows below. The user can ed

2条回答
  •  攒了一身酷
    2020-12-21 06:57

    Sounds like the problem is when you

    loop through the view model updating each of the percentage rates to match

    If so, then one answer for IE is to yield to the browser by using a timeout(0) call. When your JS resumes after the timeout, do the next iteration of the loop, then another timeout.

    When I've done this, I only do the timeouts if I've sniffed that it is an IE browser. Otherwise, not needed.

提交回复
热议问题