by MiPi » Tue Nov 03, 2020 9:24 am
This function accepts variable containing undefined value or already value with track object, nothing else (like empty object). "Fast" functions are made for situations, where speed is crucial, it is significantly faster to refill existing JS object with another data of the same type (like track in this case), instead of creating whole new large object from scratch.
Anyway, this function will be probably removed soon, fast version is not needed here. It is good when processing many objects of one type, but it has disadvantage, the contents persist only for a while, so it cannot be saved and used later, it can already contain different data. I will introduce function getNextTrack instead, returning track object or undefined value, when next track is not known (end of playing list or when shuffle is active).
This function accepts variable containing undefined value or already value with track object, nothing else (like empty object). "Fast" functions are made for situations, where speed is crucial, it is significantly faster to refill existing JS object with another data of the same type (like track in this case), instead of creating whole new large object from scratch.
Anyway, this function will be probably removed soon, fast version is not needed here. It is good when processing many objects of one type, but it has disadvantage, the contents persist only for a while, so it cannot be saved and used later, it can already contain different data. I will introduce function getNextTrack instead, returning track object or undefined value, when next track is not known (end of playing list or when shuffle is active).