Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where scripts are downloaded twice #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

caffeineaddiction
Copy link

No description provided.

original script was making 2x requests to server due to `_loadScript` setting the `src` attribute of the `<script>` element ... as it turns out you can recursively call `requireScript` from `_cacheScript` and eat your own dog food.  This kills 2 birds with one stone, it doesnt double load content on the first pass, and it shrinks the total size of the script itself because `_loadScript` can be deleted

I also made the script AMD compatible

It should be noted that removing `_loadScript` breaks backwards compatibility for browsers that do not support local-storage though I plan on adding this functionality back into the `requireScript` function along with some code to specifically check if the browser supports local storage.
@select
Copy link
Owner

select commented Apr 26, 2017

Hey there, I did not forget this, but I had no time so far. Will get to this soon hopefully. Thanks already 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants