mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-03 23:14:15 +01:00
22 lines
395 B
JavaScript
22 lines
395 B
JavaScript
/**
|
|
* @typedef {function(string): boolean} Question
|
|
*/
|
|
|
|
/**
|
|
* @typedef {function(Question): boolean} QuestionWrapper
|
|
*/
|
|
|
|
/**
|
|
* @param {QuestionWrapper[]} questions
|
|
* @param {function(): void} callback
|
|
*/
|
|
export function askAndCall(questions, callback) {
|
|
for (let question of questions) {
|
|
if (!question(window.confirm)) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
callback();
|
|
}
|