I have this code:
const intervalId = setInterval(() => {
node.send({ payload: "test string });
}, interval);
When I check the value of intervalId using node.warn, it appears to be an integer" intervalId: 909890
. However, when I then do this: flow.set("repeater", intervalId);
I see this in the context browser:
Exception: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle` and later a warning appears in debug: `"Context 5c6dd81ae4059479 contains a circular reference that cannot be persisted"`
Is there some way that I can avoid this? For info, I am trying to start and stop a repeat dynamically. Starting does not pose a problem (at least I don't think it does), but I need to be able to retrieve the ID from setInterval to be able to stop it (or, again, I think I do).
Any ideas/insight gratefully received.