Closed janeluck closed 2 years ago
Thank you for your time and affords. Apology for the late reply. Here are opinions:
If the purpose is to remove the timer, I would say the solution should be easier. Since the socket event is out of throttling scope, you could use https://github.com/samirkumardas/jmuxer/blob/3a8f6522157f8962cb68e1176ae27788148a4350/src/jmuxer.js#L341 that fires every time when the buffer is added into jMuxer.
timer callback
to a different method and invoke that newly created method inside onBuffer
if the flushingTime
is zero. In this way, you can use the same method when the timer is on or off. If the timer is on, the said method will be called from timer callback, otherwise, from onBuffer
. flushingTime
should not be 0. Let the user specify it if they want to flush directly without depending on the timer. thank you very much.
release buffer as soon as possible when flushingtime equals 0. Heavy throttling of chained JS timers beginning in Chrome 88