Different add-ons with same vendor code

Permalink
Say I have two block types on one page.
Both block types register a javascript asset by the same handle.
The loaded javascript code is also exactly the same, but each block has it packaged within itself.

Will there be conflicts when the page loads since it's going to load the same script twice? Or by setting the asset handle to be the same in each package will c5 only load one of them?

ob7dev
 
c5dragon replied on at Permalink Reply
c5dragon
I have different custom packages who use the same slider js library (same version and asset name) and it only loads once.
It uses the one from the last block that needs it.

Example:
Image Slider
Pagelist Slider

It loads the one from pagelist slider
ob7dev replied on at Permalink Reply
ob7dev
Does c5 know the code is the same because of the handle used to register the asset regardless of which package registered it?

Assuming so, that would mean if two packages register the same assets but with a different handle then c5 will load both assets?
c5dragon replied on at Permalink Best Answer Reply
c5dragon
I tested this and it uses the latest version of that handle / asset.
- Changed the asset version in one of the blocks, only latest version loads

Different handle different asset.
- Changed the asset name in one of the blocks, js loads twice only different locations
ob7dev replied on at Permalink Reply
ob7dev
So I guess the only issue that could occur is if two different package authors register the same asset but use different asset handles for the asset.
JohntheFish replied on at Permalink Reply
JohntheFish
Here is an old howto from way back when there was no asset protection and some scripts like fancybox were regularly breaking sites as yet another developer bundled their own copy, often pasting it into a view.js, so obscuring obvious clues. The trick can still be useful secondary protection.

https://legacy-documentation.concrete5.org/tutorials/protect-a-jquer...