Minor variable renaming.

This commit is contained in:
Harrison Deng 2022-03-20 19:24:09 -05:00
parent f33196c013
commit 0945e829ca

View File

@ -27,19 +27,19 @@ export default function VisualizerCore(mediaSource, fftSize = 1024) {
requestAnimationFrame(this.update); requestAnimationFrame(this.update);
}; };
let _self = this; let vcore = this; // since calling from requestAnimationFrame means "this" is no longer set to produced object.
this.update = function (timestamp) { this.update = function (timestamp) {
if (!_self._analyzing) return; if (!vcore._analyzing) return;
requestAnimationFrame(_self.update); requestAnimationFrame(vcore.update);
if (!_self.lastUpdate) { if (!vcore.lastUpdate) {
_self.lastUpdate = timestamp; vcore.lastUpdate = timestamp;
} }
let delta = timestamp - _self.lastUpdate; let delta = timestamp - vcore.lastUpdate;
_self._analyzer.getByteFrequencyData(_self._buffer); vcore._analyzer.getByteFrequencyData(vcore._buffer);
_self._updateListeners.forEach(listener => { vcore._updateListeners.forEach(listener => {
listener(delta, _self._buffer); listener(delta, vcore._buffer);
}); });
}; };
this.stop = function () { this.stop = function () {