I'm currently developing a new APP template using only Javascript/FOM. In the past, we used specific counters like f or g to count page numbers or footnote references. The reason those counters come into handy is their behaviour when a page is reformatted multiple times as they still count correctly.
I want to avoid using legacy functionality whenever it is possible and tried using a global JavaScript variable like template.myCounter to count footnotes throughout the formatting process. As a ordinary global variable (like 3B2 Script or Perl Variable), incrementing it during formatting, will just add up, if an element is reformatted multiple times. Therefore a page with a single footnote that is formatted 4 times, would result in template.myCounter+4 instead of +1.
What would be the best practice in those situations (footnotes, page number)? Using counters with the formatting.evaluateShowString() function? Does the FOM provide any information about retries?