I have a JS script that will be hosted on my server and that others will embed in their html, i.e.
...<code for http://yoursite.com />
<script type="text/javascript" src="http://mysite.com/awesome.js" />
...<code for http://yoursite.com />
My script surfaces an object with a bunch of properties accessible for use as a javascript Object(), i.e.
<script type="text/javascript">
//From http://mysite.com/awesome.js
alert(Awesome.Name);
</script>
Due to the load time variance, it seems I need to signal that the "Awesome" object in my script is ready. I need this to stand on its own, so no dependencies on specific JS frameworks.
Do I need to publish my own custom JS event, or does the simple fact that my script is loaded get captured by one of the existing page-level events? How else should I be doing this?
UPDATE: as a point of reference, if I include the JS in an HTML page running from "http://mysite.com", the Awesome object is available and populated. When the JS file is included from another domain, the object is undefined at runtime.