Files
Atay-Makhzan/web_src/js/standalone/devtest.ts
T

16 lines
628 B
TypeScript
Raw Normal View History

import {showInfoToast, showWarningToast, showErrorToast} from '../modules/toast.ts';
2023-06-27 04:45:24 +02:00
function initDevtestToast() {
2025-01-22 08:11:51 +01:00
const levelMap: Record<string, any> = {info: showInfoToast, warning: showWarningToast, error: showErrorToast};
for (const el of document.querySelectorAll('.toast-test-button')) {
el.addEventListener('click', () => {
const level = el.getAttribute('data-toast-level');
const message = el.getAttribute('data-toast-message');
levelMap[level](message);
});
}
}
2025-07-08 16:59:31 +08:00
// NOTICE: keep in mind that this file is not in "index.js", they do not share the same module system.
initDevtestToast();