Workaround for double triggering of JIRA.Events.ISSUE_REFRESHED?


I know that this problem has been around for a few years now. My question is does anyone have a workaround for the problem in which when binding to the JIRA.Events.ISSUE_REFRESHED event, the embedded code is run twice (the event is triggered twice).

For example, in the following snippet myFunction() would run twice:

JIRA.bind(JIRA.Events.ISSUE_REFRESHED, function() {

Just for clarity, for anyone unfamiliar with this snippet, the reason for binding to the JIRA.Events.ISSUE_REFRESHED event is so that when the issue is viewed in the issue navigator view, the code is still run despite a full page refresh not being triggered.

This double triggering causes a big problem for me because in reality within myFunction() I initialise a RESTful table, but this ends up being initialised twice resulting in two tables.

Thanks in advance

EDIT: Just to be clear, the JIRA.Events.NEW_CONTENT_ADDED event is also run twice.