- Added coverage reporting for Vitest with configuration in vitest.config.mjs - Updated package.json to include new scripts for JS coverage, linting, and formatting - Modified run_quality_gate.py to allow skipping ESLint and Prettier checks - Introduced .prettierrc for consistent code formatting - Created .prettierignore to exclude specific files and directories from formatting
25 lines
670 B
JavaScript
25 lines
670 B
JavaScript
/**
|
|
* Event helpers.
|
|
*
|
|
* Keep event dispatch best-effort (never throw) but avoid fully silent failures.
|
|
*/
|
|
|
|
export function safeDispatchCustomEvent(
|
|
eventName,
|
|
detail,
|
|
{ target = null, warnPrefix = "[Majoor]" } = {},
|
|
) {
|
|
const t = target || (typeof window !== "undefined" ? window : null);
|
|
if (!t || typeof t.dispatchEvent !== "function") return false;
|
|
try {
|
|
return t.dispatchEvent(new CustomEvent(eventName, { detail }));
|
|
} catch (e) {
|
|
try {
|
|
console.warn(`${warnPrefix} Failed to dispatch event: ${eventName}`, e);
|
|
} catch (e) {
|
|
console.debug?.(e);
|
|
}
|
|
return false;
|
|
}
|
|
}
|