From 6bb509cb998775bdeed9d97265b837f540722d30 Mon Sep 17 00:00:00 2001 From: Amit <42430868+Amit30swgoh@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:43:46 +0300 Subject: [PATCH] Update data.js --- js/scripts/data.js | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/js/scripts/data.js b/js/scripts/data.js index 1591624..c8c8d48 100644 --- a/js/scripts/data.js +++ b/js/scripts/data.js @@ -1,23 +1,27 @@ // scripts/data.js -// Sample JWST Mission Data (Replace with your actual data) -const jwstData = { - launchDate: "December 25, 2021", - primaryMirrorSize: "6.5 meters", - orbit: "L2 Lagrange point", - instruments: ["NIRCam", "NIRSpec", "MIRI", "FGS/NIRISS"], - scientificGoals: [ - "Study the first galaxies formed in the early universe", - "Observe the formation of stars and planetary systems", - "Analyze the atmospheres of exoplanets", - // Add more scientific goals as needed - ] -}; +// Function to fetch JWST mission data +async function fetchJWSTData() { + try { + const response = await fetch('assets/data/jwst-data.json'); + const data = await response.json(); + return data; + } catch (error) { + console.error('Error fetching JWST data:', error); + return null; + } +} -// Sample Astronomy Statistics (Replace with your actual data) -const astronomyStats = { - years: [2018, 2019, 2020, 2021, 2022], // Years - discoveries: [1200, 1500, 1800, 2000, 2300] // Number of discoveries per year -}; +// Function to fetch astronomy statistics +async function fetchAstronomyStats() { + try { + const response = await fetch('assets/data/astronomy-stats.json'); + const data = await response.json(); + return data; + } catch (error) { + console.error('Error fetching astronomy statistics:', error); + return null; + } +} -export { jwstData, astronomyStats }; +export { fetchJWSTData, fetchAstronomyStats };