Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/funny-dingos-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/scripts-modules': patch
---

Исправление ошибки "ReferenceError: DOMException is not defined"
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,14 @@ async function appendTag(
return element;
}

const ABORT_ERROR = new DOMException('The operation was aborted.');

function createElementFetcher(element: HTMLElement, abortSignal?: AbortSignal) {
return () =>
new Promise<HTMLElement>((resolve, reject) => {
element.addEventListener('load', () => {
if (abortSignal?.aborted) {
// Если во время загрузки ресурса пришел сигнал об отмене, то удаляем ресурс из DOM
element.remove();
reject(ABORT_ERROR);
reject(new DOMException('The operation was aborted.'));
} else {
resolve(element);
}
Expand All @@ -185,7 +183,7 @@ function createContentFetcher(href: string, element: HTMLElement, abortSignal?:
if (abortSignal?.aborted) {
element.remove();
// Если во время загрузки ресурса пришел сигнал об отмене, то удаляем ресурс из DOM
throw ABORT_ERROR;
throw new DOMException('The operation was aborted.');
}

// eslint-disable-next-line no-param-reassign
Expand Down
Loading