gitea源码

devtest.ts 628B

12345678910111213141516
  1. import {showInfoToast, showWarningToast, showErrorToast} from '../modules/toast.ts';
  2. function initDevtestToast() {
  3. const levelMap: Record<string, any> = {info: showInfoToast, warning: showWarningToast, error: showErrorToast};
  4. for (const el of document.querySelectorAll('.toast-test-button')) {
  5. el.addEventListener('click', () => {
  6. const level = el.getAttribute('data-toast-level');
  7. const message = el.getAttribute('data-toast-message');
  8. levelMap[level](message);
  9. });
  10. }
  11. }
  12. // NOTICE: keep in mind that this file is not in "index.js", they do not share the same module system.
  13. initDevtestToast();