question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoiding duplicate downloads

See original GitHub issue

I have the issue that scripts are loaded multiple times. I would have expected that scripts that have been loaded or are in the middle of loading won’t be loaded each time.

loadjs(['libraryA.js', 'usingA.js'], {
  success: function() { /* done loading */ },
  async: false
});

loadjs(['libraryA.js', 'libraryB_usingA.js', 'usingA_B.js'], {
  success: function() { /* done loading */ },
  async: false
});

In the above example libraryA.js gets loaded twice. I’ve been trying to avoid this issue by using bundleIds and loadjs.ready but this gets complicated quite quickly.

Am I missing something here?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
amoreycommented, Sep 28, 2018

@groupedsi @naltatis Here’s a new lightweight dependency manager I created called JohnnyDepp that implements the require method you requested: https://github.com/muicss/johnnydepp

Let me know what you think.

1reaction
amoreycommented, Sep 28, 2018

Great! I’m happy to hear you like it. LoadJS and JohnnyDepp share the same underlying file loading code but their API’s are different enough that I thought combining them into one library would be confusing.

JohnnyDepp is tested across all major browsers and should be production-ready so give it a try and let me know if it works for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoid Duplicate Downloads
This extension will prompt the file… If you are tired of having download(1)(2).pdf in your Downloads folder, look no further. This extension ...
Read more >
How to avoid duplicate download. - Microsoft Community
How to avoid duplicate download. ... Look for an extension that works with any page, because that extension works only on the "Pixiv"...
Read more >
How to stop duplicate downloads in Chrome [Tip] - dotTech
How to stop duplicate downloads in Chrome · In Chrome, open the “Have I Downloaded This Before?” extension page from the Web Store....
Read more >
Avoid Duplicate Downloads - Chrome Extension - Indie Hackers
When downloading files with the same name, Chrome just appends (1) at the end of the filename and saves it to your download...
Read more >
How To Avoid Duplicate Downloads In Responsive Images
The idea behind a <picture> example like this is that exactly one image should be downloaded, according to the user's context:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found