FILE / ScuroNeko/scuroneko.dev

js/data.js

Исходный файл и его история в репозитории.
FILE ae67b91d1c2aaa214ca545875ef1af9acffddec7
Files
scuroneko.dev/js/data.js
T

35 lines
696 B
JavaScript

let stackList = [];
let projectsList = [];
let workstationsList = [];
let linksList = [];
const fetchJson = async (path) => {
const response = await fetch(path);
if (!response.ok) {
throw new Error(`Failed to load ${path}: ${response.status}`);
}
return response.json();
};
const loadIcon = async (key) => {
const response = await fetch(`./img/icons/${key}.svg`);
if (!response.ok) {
return key;
}
return response.text();
};
const formatIndex = (index) => String(index + 1).padStart(2, "0");
document.addEventListener("DOMContentLoaded", () => {
loadStack()
.then(loadProjects)
.then(loadWorkstations)
.then(loadLinks)
.catch(console.error);
});