Board Thread:General Coding Help/@comment-24473195-20141103204653/@comment-24473195-20141105084204

Penguin-Pal wrote: You can use importArticles in the following way: The order of the scripts in your array determines the order at which they will be executed (from first to last).

You don't need intervals or anything for that, unless the script with the variables gets data from another file (e.g. JSON file/web worker), which could result the execution of the main script before you get some vital resources. If that's the case, you can import your main script via your variable script, in a way that it would imported as soon as all the resources in the variable script have loaded. I followed your advise and it seemed to work Jumbles, I've updated the code on there.

Cqm wrote: One caveat with Penguin-Pal's suggestion, if you're using IIFEs. If you have something like /* script 1 */ ( function { ... } ); /* script 2 */ ( function { ... } ); it can have some weird effect if script 2 has a dependency on script 1. The simplest way to workaround it is to work with globals in script 1 (without using an IIFE) and then coding as normal in script 2, e.g. /* script 1 */ window.someVar = {}; /* script 2 */ ( function { ... } ); I'm not sure what causes the weird effect, I've asked around and think it's something to do with a side effect of how js is implemented. Interesting, I read up a bit on it, it may explain the strange effects. My guess is that wikia's implementation of it causes these kinds of discrapencies, as this was never a problem when I debugged the script offline using netbeans.