Board Thread:Support Requests - Getting Technical/@comment-4018164-20130630192127/@comment-4674838-20130630201625

In some cases, when you're modifying features that loads asynchronously, you may not have a way to control the order in which things load/execute. A worst-case solution that works in that scenario is looping feature detection.

Here's pseudocode that describes this approach:


 * Check if the feature has loaded yet
 * If it has, run your script. Exit loop.
 * If it hasn't, check again 1 second later (loop).

Here's partially implemented JavaScript that provides a framework:

I should emphasize that this is not that great of a solution, but I'm mentioning it because it has the benefit of being relatively easy to understand and use. [You could even create and increment a counter to make sure it doesn't loop infinitely (in case the feature never loads). Although for simplicity's sake, I haven't included that here.]