proximity.removeAllListeners("data");to make it stop but since I'm using Typescript I don't have the inheritance relationship between
Proximity < Withinable < EventEmitter
reactStateIsTrueflag as part of props and uses it to tell the Proximity object whether or not to log the cm read (if only the Proximity object would actually listen to the state's changes).
reactStateIsTrue) flag is a boolean that was initiated as:
const [reactStateIsTrue, stop] = useState(true);
I think the best we can do is a "pause/resume", which would "pause" the emitters from emitting until you call "resume"
Would this be something that could be solved by myself with your advice/guidance or is this something that could be implemented eventually in the project?
proximity.pause()to stop events from emitting
pause()actually do? I'm trying to plot a real-time plot with Plotly and when I use
pause()it resets the plot. It does pause the reading but the unwanted effect is that I now need to save the plot data before hitting
pause()so that it doesn't disappear, but stays there frozen instead.
as anycast worked fine :)
resume()on everything that's an event emitter!
resume(), which takes the object out of the weakmap and sets
_events = ...