Skip to content

Instantly share code, notes, and snippets.

@tauren
Created June 28, 2012 23:02
Show Gist options
  • Save tauren/3014569 to your computer and use it in GitHub Desktop.
Save tauren/3014569 to your computer and use it in GitHub Desktop.
<script>
// Load browser shims
Modernizr.load([
{
test: window.JSON,
nope: 'libs/shims/json3.js'
},
{
test: Object.getOwnPropertyNames,
nope: "libs/shims/es5-shim.js",
callback: function() {
// Many more modern browsers do not support Function.bind
// Copy from es5-shim referenced above. Copyright the original authors. MIT License.
if(!Function.prototype.bind){var slice=Array.prototype.slice;Function.prototype.bind=function a(a){function d(){if(this instanceof d){var a=Object.create(b.prototype);b.apply(a,c.concat(slice.call(arguments)));return a}else{return b.call.apply(b,c.concat(slice.call(arguments)))}}var b=this;if(typeof b.apply!=="function"||typeof b.call!=="function")return new TypeError;var c=slice.call(arguments);d.length=typeof b==="function"?Math.max(b.length-c.length,0):0;return d}}
}
}
]);
</script>
<script>
var app = new Application();
$(function() {
app.start();
});
</script>
@tauren
Copy link
Author

tauren commented Jun 28, 2012

I want app.start() to run only after DOM is ready and the json3.js and es5-shim.js files are done loading. What is the best way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment