Skip to content

Instantly share code, notes, and snippets.

@kentcdodds kentcdodds/README.md
Last active Dec 19, 2015

Embed
What would you like to do?
How to check whether an external resource loaded and load a local copy if it failed to load. See README.md

Double Take Script Loader

This has been moved to an official Git repository

@klamping

This comment has been minimized.

Copy link

commented Jul 11, 2013

I think the code looks really clean. As a suggestion, I'd consider allowing a timeout method to be added, to give the CDN just a little bit of time to load the script before bailing out to the local copy. Also, I assume that removing the script stops the CDN version from loading? Good stuff.

@kentcdodds

This comment has been minimized.

Copy link
Owner Author

commented Jul 17, 2013

@klamping, thanks for the feedback. I'll look into the timeout concept a little. But I believe that the browser waits for each script to load/fail before moving on to parsing the rest of the document (hence the "best practice" of including scripts at the bottom of your page right before the tag).

@kentcdodds

This comment has been minimized.

Copy link
Owner Author

commented Jul 17, 2013

Note to self Figure out a way to add an option for libraries that attach themselves to the namespace of other global variables (like jQuery plugins or AngularJS modules).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.