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
9 changes: 8 additions & 1 deletion packages/@uppy/utils/src/AbortController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import hasOwnProperty from './hasProperty.js'
/**
* Little AbortController proxy module so we can swap out the implementation easily later.
*/
export const { AbortController } = globalThis
export const { AbortSignal } = globalThis
export const createAbortError = (message = 'Aborted') => new DOMException(message, 'AbortError')
export const createAbortError = (message = 'Aborted', options) => {
const err = new DOMException(message, 'AbortError')
if (options != null && hasOwnProperty(options, 'cause')) {
Object.defineProperty(err, 'cause', { __proto__: null, configurable: true, writable: true, value: options.cause })
}
return err
}
2 changes: 1 addition & 1 deletion packages/@uppy/utils/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ declare module '@uppy/utils/lib/toArray' {
declare module '@uppy/utils/lib/AbortController' {
export const AbortController: typeof globalThis.AbortController
export const AbortSignal: typeof globalThis.AbortSignal
export function createAbortError(message?: string): DOMException
export function createAbortError(message?: string, options?: ErrorOptions): DOMException
}

declare module '@uppy/utils/lib/getDroppedFiles' {
Expand Down