Исправление компиляции, добавление отладки

This commit is contained in:
2024-03-21 19:52:32 +04:00
parent 387b3925c6
commit ca1a01a06e
5 changed files with 107 additions and 32 deletions
+21
View File
@@ -23,3 +23,24 @@ export function getTextNodes(
filter((_, node) => node.nodeType === Node.TEXT_NODE);
}
let debugEnabled = ((scriptElement) => {
if (!(scriptElement instanceof HTMLScriptElement)) {
return false;
}
return !/\.min\.js$/.test(scriptElement.src);
})(document.currentScript);
/**
* Отоброзить отладочное сообщение
*/
export function debug(...data: (string|number|object)[]) {
if (!debugEnabled) return;
console.log(...data);
}
/**
* Включить отладку
*/
export function enableDebug() {
debugEnabled = true;
}