Fixed a documentation issue.

And added some notes in the form of comments.
This commit is contained in:
Harrison Deng 2022-04-17 14:09:23 -05:00
parent 4a5483ab59
commit b771d211a4

View File

@ -71,8 +71,10 @@ export function mapRangedAvgNumerical({ minVal, maxVal, lowerBin = undefined, up
setter(minVal + range * interpolated); setter(minVal + range * interpolated);
} }
}; };
visUpdateManager.addVisualizerRangedUpdateListener(rangedListener); if (visUpdateManager.addVisualizerRangedUpdateListener(rangedListener)) {
return rangedListener; return rangedListener;
}
return null; // Technically doesn't occur since the functions are anonymous?
} }
/** /**
@ -87,7 +89,7 @@ export function mapRangedAvgNumerical({ minVal, maxVal, lowerBin = undefined, up
* @param {interpolator} conf.interpolator The interpolation function to use. * @param {interpolator} conf.interpolator The interpolation function to use.
* @param {VisualizerUpdateManager} conf.visUpdateManager The update manager to map to. * @param {VisualizerUpdateManager} conf.visUpdateManager The update manager to map to.
* @param {boolean} [conf.reversed] If true, then high amplitudes will be mapped to lower values and vice versa. * @param {boolean} [conf.reversed] If true, then high amplitudes will be mapped to lower values and vice versa.
* @returns {bin: number, listener: VisualizerUpdateManager.visualizerBinUpdateListener} * @returns {{bin: number, listener: VisualizerUpdateManager.visualizerBinUpdateListener}} The bin listener that was added.
*/ */
export function mapBinNumerical({ minVal, maxVal, bin, getter, setter, interpolator, visUpdateManager, reversed = false }) { export function mapBinNumerical({ minVal, maxVal, bin, getter, setter, interpolator, visUpdateManager, reversed = false }) {
const listener = { const listener = {
@ -99,6 +101,9 @@ export function mapBinNumerical({ minVal, maxVal, bin, getter, setter, interpola
setter(minVal + range * interpolated); setter(minVal + range * interpolated);
} }
}; };
visUpdateManager.AddVisualizerBinUpdateListener(listener); if (visUpdateManager.AddVisualizerBinUpdateListener(listener)) {
return listener; return listener;
} }
return null; // Technically doesn't occur since the functions are anonymous?
}