I was trying out this plugin called "Timer Component". It basically provides us with a stopwatch functionality. We can also stop it automatically at some given time interval. I just tried to create a functionality where this plugin can be used to refresh a variable automatically in custom time intervals ( also less than 30 sec). Is it a good way to do it?
a!localVariables( local!total: 50, local!bool: false, local!refreshAfter: 5, { stopWatchField( /*label: "Stopwatch Timer",*/ labelPosition: "ABOVE", validations: {}, height: "AUTO", action: "START", size: null, align: null, expiredMessage: null, color: "#FFF", style: null, timerDirection: null, enableReverseTimer: null, reverseTimerColor: null, secondsValue: local!total, secondsSaveInto: { a!save( local!bool, not(local!bool) ), a!save( local!total, local!total-local!refreshAfter ), if( local!total<30, a!save(local!total,50), {} ) }, enableAutoStop: true, autoStopTimerSeconds: local!total-local!refreshAfter, autoStopType: "AT" ) } )
Discussion posts and replies are publicly visible
As much as I understand, 30 seconds was added with the thought that refreshing variables in less than that time will have performance impacts on the interface and its components.
If the save is just a trivial one with no complexity (eg. changing the value of a single integer variable), then it won't have any severe impact but as the save gets more complex, it will have an impact that will increase with the complexity.
So I guess unless it is
then it is okay to use else try not using it for altering the refresh intervals.
Thanks for replying Harshit!
Actually, I was trying to make an interface where users can see the stats of a live match and for that, the score must be refreshed every 5 or 10 seconds. So I was thinking of using this plugin to achieve this.
If the code works fine for your use case no harm in using that.
Okay!