My question is about a smarter solution / alternative to callbacks / promises or global variables.
Situation: I have a program which is event-driven. I know that Function A will calculate a value v that I will need at a later point. A will be called right at the start of the program. Function B may or may not be triggered by an event at a later point.
Question: How can I pass v from A to B without using a callback, since B should not be called by A but rather by some event. How can I avoid using a global Variable (since they are bad)?