Knockout causing “slow running script” warning in IE

前端 未结 2 562
忘掉有多难
忘掉有多难 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:43

    Ok, this stinks, but I think the problem is that I had this on my page:

    <div data-bind="text: ko.toJSON($root)"></div>
    

    After I removed that it didn't give me the “slow running script” warning.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题