Thursday, 8 August 2013

Extended JavaScript class from separate file

Extended JavaScript class from separate file

I'm sorry to ask quite a dim question as I'm very new to OOP in JavaScript.
I'm trying to use John Resig's Simple JavaScript Inheritance method, and
ideally I'd like to store this within say utils.js, and then use it (using
Class.extend), throughout the range of script files that my project uses.
Is this possible? I've noticed that if I create a subclass from within my
utils.js file, I can then create a new instance of that class from a
different script, so that makes me think it might be possible. Does it
have something to do with the method being wrapped in an
immediately-invoked function expression?

No comments:

Post a Comment