Timing issues with overriding js functions across files
<p>In my rails project, I've written a javascript function to override the default behaviour of an object in another defined in another file. The line that did this looked something like:</p>

<pre><code>window.someObject.methodToOverride = function...
</code></pre>

<p>Initially this would get me a <code>cannot set property 'methodToOverride' of undefined</code> error, which I'm assuming was related to the a timing issue (with <code>someObject</code> not being setup yet). I was able to resolve the issue by chucking it in a jQuery <code>$(document).ready</code> function, but while that works, it seems a bit hacky to me.</p>

<p>Is there a better way to do this?</p>
