[javascript] How to detect if javascript files are loaded?