// init.js - Data loading functions (pure library, no auto-execution) // Called by bootstrap.js in the proper sequence // Load artifacts from JSON export async function loadArtifacts() { try { const response = await fetch('/data/artifacts.json'); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const artifacts = await response.json(); // Make globally available window.allArtifacts = artifacts; return artifacts; } catch (error) { console.error('Failed to load artifacts:', error); window.allArtifacts = []; throw error; } } // Helper functions for accessing loaded data export function getArtifacts() { return window.allArtifacts || []; } export function getFeaturedArtifacts() { const artifacts = getArtifacts(); return artifacts .filter(artifact => artifact.featured === true) .sort((a, b) => new Date(b.date) - new Date(a.date)); } export function getAreasData() { return window.areasData || {}; } // Legacy app object for backward compatibility with existing code export const app = { getArtifacts, getFeaturedArtifacts, getAreasData, waitForInit: () => Promise.resolve() // No-op since bootstrap handles initialization }; // Make available globally for non-module scripts window.app = app;