I'm using Truffle (Webpack Box) and watching events on the front end. I'm having to design around ensuring I do not initiate watching for events more than once. Is there a best practice on how to do this? Is there a quick way to tell if an event is already being watched?
When you start watching the events with
filter = myInstance.EVENT(filter, additionalFilter, callback)
you can store the returned
filter. If you have the
filter and your callback didn't run into an error, you can assume that you're watching, otherwise the watching has stopped.
If you want to explicitly stop watching the events, call