As I continue working on this function, a question arises regarding the safety of changing variables in this manner.
In my Angular service, I utilize utility functions where context
represents this
from the component calling the function. The code snippet provided should clarify things further:
changeValueOverTime(context: any, varToChange: string, amount: number, intervalTime: number) {
const interval = setInterval(() => {
context[varToChange] = 200;
}, intevalTime);
}
An update has been made to this function, and you can view it here: