From the docs:
connectionStateChange.addListener
This event will also be fired once during app startup, as soon as we determine the connection status.
I'm having an issue where, in some cases, the listener is bound too late and misses the initial firing of the connection state change event.
At what specific point in time can I start expecting the event to be fired? At what point should I start listening in order to guarantee that I don't miss it?
If you put your binding code outside of any callbacks, you should always be bound to the event before the initial trigger:
// OK
forge.event.connectionStateChange.addListener(function () { ... });
$(function () {
// not necessarily OK
forge.event.connectionStateChange.addListener(function () { ... });
});
I've created a story for us to fire late-bound listeners immediately too, to obviate the issue.