BrX
BrX

Reputation: 23

How to determine that the function (renderer) was not called since some time(finished)?

I have a table which contains attributes of some elements, and I am aplying some custom events on each input using extjs and pure javascript in 'onready' event. This table has also renderer atached, for each column, and it fires when I scroll down, to see elements that was not seen in the begining, after that my changes are lost in elements from the top, and not applied to the bottom. So my question is:

How Can I check if funcion was not called since 100 ms, and it is not called anymore? Simple flag in the function could be okay in normal case, but this one fires many times, and then it is not exectued anymore. Any ideas?

I can only use pure JS and EXTJS.

Upvotes: 1

Views: 60

Answers (2)

Alexander
Alexander

Reputation: 20224

You can use Ext.Function.createBuffered to create a buffered function.

You then call the resulting function from the renderer. The inner function is automatically executed when the renderer has not been called for the predefined time. If it is called in the meantime, the timer starts running again.

Upvotes: 1

Mateusz Walas
Mateusz Walas

Reputation: 1

Assign every function a property, let's say ,,time" with Date.now() when the page is loaded and every time the function is fired update this property with Date.now() and check is (during function execution) Date.now() - time < 100.

Upvotes: 0

Related Questions