Hi Group,
I couldn't find an answer on this with Google, so let me test you :)
I've a fairly complex WebApp, and I put most of the JS code in
independent external .js files. One of these external files contains a
class A. The inline JS then inherits a class B from A.
My question is now, since the class A is defined in the external file,
is the class A definitely known at the point where I use it? I could
imagine a case where the external js is loaded much slower, so the
js-parser would already try to new A() without knowing of it.
If I would run in a race condition, how could I get around it?
Thanks in advance.
-j
The html looks like this:
<html>
<head>
<script src="class_a.js" type="text/javascript"></script>
</head>
<body>
...
</body>
<script type="text/javascript">
// inline code
function B()
{
this.is="cool";
}
B.prototype = new A();
B.prototype.constructor=B;
</script>
</body>
</html>