i want functs to execute?
implementation:
acInit([
onAvatarChangeEvent,
async () => {
await loadavatarDdl();
await fetchDetails();
},
() => acFormHandler('basicInfoForm', submitDetails),
() => acFormHandler('passForm', submitPass)
]);
defn in global functions' file
function acInit(functions: (() => void)[]): void {
if (document.readyState === "complete") {
functions.forEach(func => func());
} else {
document.addEventListener('DOMContentLoaded', () => {
functions.forEach(func => func());
});
}
}
onAvatarChangeEvent, acFormHandler both return void?
await Promise.all([ onAvatarChangeEvent, async () => { await loadavatarDdl(); await fetchDetails(); }, () => acFormHandler('basicInfoForm', submitDetails), () => acFormHandler('passForm', submitPass), ]);
Обсуждают сегодня