Skip to content

Commit 6a03965

Browse files
committed
feat: Update audio source to Creative Commons and improve cache busting implementation
1 parent ce7e479 commit 6a03965

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

docs/src/views/Examples.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ ResourceLoader.include(['https://picsum.photos/400/300'], {
238238

239239
<div class="bg-gray-50 p-4 mb-6 rounded-md">
240240
<pre class="text-sm overflow-x-auto"><code>// Load an audio file from a Creative Commons source
241-
ResourceLoader.include(['https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'], {
241+
ResourceLoader.include(['https://assets.codepen.io/252820/peter.mp3'], {
242242
onSuccess: (url) => {
243243
// For non-binary loading, we get the URL directly
244244
const audioContainer = document.getElementById('audio-container');
@@ -251,7 +251,7 @@ ResourceLoader.include(['https://www.soundhelix.com/examples/mp3/SoundHelix-Song
251251

252252
const sourceInfo = document.createElement('div');
253253
sourceInfo.className = 'mt-2 text-sm text-gray-500';
254-
sourceInfo.textContent = 'Audio from SoundHelix.com (CC-BY)';
254+
sourceInfo.textContent = 'Peter and the Wolf - Creative Commons';
255255

256256
audioContainer.appendChild(audioElement);
257257
audioContainer.appendChild(sourceInfo);
@@ -700,7 +700,7 @@ export default {
700700
const audioContainer = document.getElementById('audio-container');
701701
audioContainer.innerHTML = '<div class="text-center text-gray-500">Loading audio...</div>';
702702
703-
window.ResourceLoader.include(['https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'], {
703+
window.ResourceLoader.include(['https://assets.codepen.io/252820/peter.mp3'], {
704704
onSuccess: (url) => {
705705
// For non-binary loading, we get the URL directly
706706
audioContainer.innerHTML = ''; // Clear previous results
@@ -712,7 +712,7 @@ export default {
712712
713713
const sourceInfo = document.createElement('div');
714714
sourceInfo.className = 'mt-2 text-sm text-gray-500';
715-
sourceInfo.textContent = 'Audio from SoundHelix.com (CC-BY)';
715+
sourceInfo.textContent = 'Peter and the Wolf - Creative Commons';
716716
717717
audioContainer.appendChild(audioElement);
718718
audioContainer.appendChild(sourceInfo);
@@ -837,22 +837,23 @@ export default {
837837
document.getElementById('cache-results').innerHTML = '';
838838
document.getElementById('cache-timestamp').textContent = 'Loading...';
839839
840+
// Generate timestamp once so we can display it correctly
841+
const timestamp = new Date().getTime();
842+
const cacheBustingQuery = `?_cb=${timestamp}`;
843+
840844
// Enable cache busting for all supported file types
841845
window.ResourceLoader.include(['/sample-script.js', '/sample-style.css', '/sample-data.json'], {
842846
cacheBusting: true,
843-
cacheBustingQuery: `?_cb=${new Date().getTime()}`,
847+
cacheBustingQuery: cacheBustingQuery,
844848
cacheBustingTypes: ['js', 'css', 'json'],
845849
// Only apply cache busting to files from your own domain
846850
restrictCacheBustingToLocal: true,
847851
onSuccess: (url) => {
848852
document.getElementById('cache-results').innerHTML +=
849853
`<div class="text-green-500">✓ Loaded: ${url}</div>`;
850854
851-
// Extract the cache busting parameter to show it worked
852-
if (url.includes('?_cb=')) {
853-
const timestamp = url.split('?_cb=')[1];
854-
document.getElementById('cache-timestamp').textContent = timestamp;
855-
}
855+
// Update the timestamp display - we already know the value
856+
document.getElementById('cache-timestamp').textContent = timestamp;
856857
}
857858
});
858859
}

0 commit comments

Comments
 (0)