edit for clarity

This commit is contained in:
David Tsay 2024-07-03 11:29:10 -07:00
parent 1aa30975e5
commit 1d77368c7c

View File

@ -135,30 +135,30 @@ class TimeAPI extends GlobalTimeContext {
/** /**
* Get or set an independent time context which follows the TimeAPI timeSystem, * Get or set an independent time context which follows the TimeAPI timeSystem,
* but with different offsets for a given domain object * but with different bounds for a given domain object
* @param {string} key The identifier key of the domain object these offsets are set for * @param {string} keyString The keyString identifier of the domain object these offsets are set for
* @param {ClockOffsets | TimeConductorBounds} value either offsets if in realtime mode, or bounds if in fixed mode * @param {TimeConductorBounds | ClockOffsets} boundsOrOffsets either bounds if in fixed mode, or offsets if in realtime mode
* @param {key | string} clockKey the real time clock key currently in use * @param {string} clockKey the key for the real time clock to use
*/ */
addIndependentContext(key, value, clockKey) { addIndependentContext(keyString, boundsOrOffsets, clockKey) {
let timeContext = this.getIndependentContext(key); let timeContext = this.getIndependentContext(keyString);
//stop following upstream time context since the view has it's own //stop following upstream time context since the view has it's own
timeContext.resetContext(); timeContext.resetContext();
if (clockKey) { if (clockKey) {
timeContext.setClock(clockKey); timeContext.setClock(clockKey);
timeContext.setMode(REALTIME_MODE_KEY, value); timeContext.setMode(REALTIME_MODE_KEY, boundsOrOffsets);
} else { } else {
timeContext.setMode(FIXED_MODE_KEY, value); timeContext.setMode(FIXED_MODE_KEY, boundsOrOffsets);
} }
// Notify any nested views to update, pass in the viewKey so that particular view can skip getting an upstream context // Notify any nested views to update, pass in the viewKey so that particular view can skip getting an upstream context
this.emit('refreshContext', key); this.emit('refreshContext', keyString);
return () => { return () => {
//follow any upstream time context //follow any upstream time context
this.emit('removeOwnContext', key); this.emit('removeOwnContext', keyString);
}; };
} }