Skip to content

Class: AnyDrop ​

Defined in: ui/src/AnyDrop.ts:142

The AnyDrop UI: a drop zone with file and folder pickers, a folder tree, a toolbar, an error panel, thumbnails and a mobile layout. It extends AnyDropCore, so every core option, method and event works.

Example ​

ts
const ad = new AnyDrop('#uploader', { url: '/upload', chunking: true });
ad.on('queuecomplete', () => console.log(ad.getErrors()));

Extends ​

Constructors ​

Constructor ​

ts
new AnyDrop(element, config?): AnyDrop;

Defined in: ui/src/AnyDrop.ts:254

Attaches to an element (or a selector). Throws when there is no URL or the selector matches nothing.

Parameters ​

ParameterType
elementstring | HTMLElement
config?AnyDropConfig

Returns ​

AnyDrop

Overrides ​

AnyDropCore.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionOverridesInherited fromDefined in
disabledpublicbooleanfalseSet by disable(), cleared by enable().-AnyDropCore.disabledcore/src/AnyDropCore.ts:172
elementreadonlyHTMLElementundefinedThe element the instance is attached to.--ui/src/AnyDrop.ts:201
errorsprotected readonlyErrorRegistryundefinedThe error list. Protected so subclasses can read it; do not shadow it.-AnyDropCore.errorscore/src/AnyDropCore.ts:179
filesreadonlyAnyDropFile[][]Every file added and not removed, in add order. Do not modify.-AnyDropCore.filescore/src/AnyDropCore.ts:170
optionsreadonlyAnyDropCoreOptions<AnyDrop> & AnyDropUIOptions & AnyDropEventHandlers<AnyDrop> & AnyDropCoreOptions<AnyDropCore> & AnyDropEventHandlers<AnyDropCore>undefinedResolved options (defaults merged with yours). Change them with setOption().AnyDropCore.options-ui/src/AnyDrop.ts:199
treeprotected readonlyTreeStore...The folder tree. Protected so subclasses (@vedratech/anydrop-ui) can read it; do not shadow it.-AnyDropCore.treecore/src/AnyDropCore.ts:177
ACCEPTEDstatic readonly"queued"ACCEPTEDAlias of QUEUED.-AnyDropCore.ACCEPTEDcore/src/AnyDropCore.ts:149
ADDEDstatic readonly"added"ADDEDStatus constant 'added'.-AnyDropCore.ADDEDcore/src/AnyDropCore.ts:145
autoDiscoverstaticbooleantrueRead by the CDN build only: set it to false right after the script tag to stop auto-discovery.--ui/src/AnyDrop.ts:150
CANCELEDstatic readonly"canceled"CANCELEDStatus constant 'canceled'.-AnyDropCore.CANCELEDcore/src/AnyDropCore.ts:161
ERRORstatic readonly"error"ERRORStatus constant 'error'.-AnyDropCore.ERRORcore/src/AnyDropCore.ts:159
instancesstaticAnyDrop[][]Every live instance (removed again by destroy()).--ui/src/AnyDrop.ts:146
isValidFilestatic readonly(file, acceptedFiles) => booleanisValidFileWhether a file passes a type list such as 'image/*,.pdf'; an empty MIME type is judged by its extension.-AnyDropCore.isValidFilecore/src/AnyDropCore.ts:163
localesstaticRecord<string, AnyDropLocale>{}Language packs by code. The CDN files dist/locales/<code>.global.js fill it; you can register your own.--ui/src/AnyDrop.ts:148
optionsstaticRecord<string, AnyDropConfig | false>{}Options per element id (camelCased), used when an element is attached: AnyDrop.options.myId = { ... }.--ui/src/AnyDrop.ts:144
PAUSEDstatic readonly"paused"PAUSEDStatus constant 'paused'.-AnyDropCore.PAUSEDcore/src/AnyDropCore.ts:155
PROCESSINGstatic readonly"uploading"PROCESSINGAlias of UPLOADING.-AnyDropCore.PROCESSINGcore/src/AnyDropCore.ts:153
QUEUEDstatic readonly"queued"QUEUEDStatus constant 'queued'.-AnyDropCore.QUEUEDcore/src/AnyDropCore.ts:147
SUCCESSstatic readonly"success"SUCCESSStatus constant 'success'.-AnyDropCore.SUCCESScore/src/AnyDropCore.ts:157
UPLOADINGstatic readonly"uploading"UPLOADINGStatus constant 'uploading'.-AnyDropCore.UPLOADINGcore/src/AnyDropCore.ts:151
uuidv4static readonly() => stringuuidv4Creates a UUID version 4.-AnyDropCore.uuidv4core/src/AnyDropCore.ts:165
versionstatic readonlystringVERSIONLibrary version.-AnyDropCore.versioncore/src/AnyDropCore.ts:143

Accessors ​

hiddenFileInput ​

Get Signature ​

ts
get hiddenFileInput(): HTMLInputElement | null;

Defined in: ui/src/AnyDrop.ts:279

The hidden <input type=file> the file picker opens.

Returns ​

HTMLInputElement | null


isDestroyed ​

Get Signature ​

ts
get isDestroyed(): boolean;

Defined in: core/src/AnyDropCore.ts:1145

Whether destroy() was called.

Returns ​

boolean

Inherited from ​

AnyDropCore.isDestroyed

Methods ​

_addFormElementData() ​

ts
protected _addFormElementData(formData): void;

Defined in: ui/src/AnyDrop.ts:290

The fields of a <form> element go with every request, once.

Parameters ​

ParameterType
formDataFormData

Returns ​

void

Overrides ​

AnyDropCore._addFormElementData


_completeExternal() ​

ts
protected _completeExternal(file): void;

Defined in: core/src/AnyDropCore.ts:344

Hook for subclasses: emits complete for a file outside the queue (a displayExistingFile mock file, which is in neither files nor the tree), then re-checks queuecomplete while a run is open, so it can never fire an extra queuecomplete when idle.

Parameters ​

ParameterType
fileAnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore._completeExternal


addDataTransfer() ​

ts
addDataTransfer(dataTransfer): Promise<AnyDropFile[]>;

Defined in: core/src/AnyDropCore.ts:402

Adds the contents of a DataTransfer (files and folders) as one batch, without a drop event.

Parameters ​

ParameterType
dataTransferDataTransferLike

Returns ​

Promise<AnyDropFile[]>

Inherited from ​

AnyDropCore.addDataTransfer


addFile() ​

ts
addFile(file, folderPath?): AnyDropFile;

Defined in: core/src/AnyDropCore.ts:424

Adds one file. folderPath places it in a folder ('Photos/2024'); without it, a non-empty webkitRelativePath is used, else the file is loose. Calls in the same tick form one batch. Returns the file with its properties added.

Parameters ​

ParameterType
fileFile
folderPath?string

Returns ​

AnyDropFile

Inherited from ​

AnyDropCore.addFile


addFiles() ​

ts
addFiles(files): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:441

Adds several files as one batch (see addFile).

Parameters ​

ParameterType
filesArrayLike<File> | Iterable<File, any, any>

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.addFiles


addFromInput() ​

ts
addFromInput(input): Promise<AnyDropFile[]>;

Defined in: core/src/AnyDropCore.ts:411

Adds the files of a file or folder input (<input type=file>, <input webkitdirectory>), or a FileList, as one batch. Folder paths come from webkitRelativePath.

Parameters ​

ParameterType
input| ArrayLike<File> | { files?: ArrayLike<File> | null; }

Returns ​

Promise<AnyDropFile[]>

Inherited from ​

AnyDropCore.addFromInput


cancelFolder() ​

ts
cancelFolder(path): void;

Defined in: core/src/AnyDropCore.ts:633

Cancels every unfinished file under a folder (cancelUpload per file: canceled, complete), then foldercomplete fires. The files keep their tree rows.

Parameters ​

ParameterType
pathstring

Returns ​

void

Inherited from ​

AnyDropCore.cancelFolder


cancelUpload() ​

ts
cancelUpload(file): void;

Defined in: core/src/AnyDropCore.ts:1023

Cancels a file: aborts its requests, status canceled, then canceled and complete. With uploadMultiple, every file sharing its request is canceled.

Parameters ​

ParameterType
fileAnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore.cancelUpload


clearErrors() ​

ts
clearErrors(): void;

Defined in: core/src/AnyDropCore.ts:517

Empties the error list. The files stay in error.

Returns ​

void

Inherited from ​

AnyDropCore.clearErrors


clearPersistedState() ​

ts
clearPersistedState(): Promise<void>;

Defined in: core/src/AnyDropCore.ts:645

Deletes this persistKey's resume records (a "start over" button), and the claims of the files in the list, so they stop writing records. Does nothing when persistState is false.

Returns ​

Promise<void>

Inherited from ​

AnyDropCore.clearPersistedState


copyErrors() ​

ts
copyErrors(): Promise<boolean>;

Defined in: ui/src/AnyDrop.ts:413

Copies the error list (JSON) to the clipboard. Resolves false when the browser refuses.

Returns ​

Promise<boolean>


destroy() ​

ts
destroy(): void;

Defined in: ui/src/AnyDrop.ts:424

Aborts every request, removes every listener and timer. The instance cannot be used again. No removedfile events are emitted.

Returns ​

void

Overrides ​

AnyDropCore.destroy


disable() ​

ts
disable(): void;

Defined in: ui/src/AnyDrop.ts:382

Sets disabled and cancels every file. Adding files still works.

Returns ​

void

Overrides ​

AnyDropCore.disable


displayExistingFile() ​

ts
displayExistingFile(
   mock, 
   imageUrl, 
   callback?, 
   crossOrigin?, 
   resizeThumbnail?
): void;

Defined in: ui/src/AnyDrop.ts:350

Shows a file that is already on the server . The mock file is not added to files, the tree, the queue or a manifest.

Parameters ​

ParameterTypeDefault value
mockMockFileundefined
imageUrlstringundefined
callback?(() => void) | nullundefined
crossOrigin?string | nullundefined
resizeThumbnail?booleantrue

Returns ​

void


downloadErrors() ​

ts
downloadErrors(format?): void;

Defined in: ui/src/AnyDrop.ts:395

Downloads the error list as a file (anydrop-errors.json or .csv).

Parameters ​

ParameterTypeDefault value
format?"json" | "csv"'json'

Returns ​

void


drop() ​

ts
drop(event): Promise<AnyDropFile[]>;

Defined in: core/src/AnyDropCore.ts:386

Handles a drop event: emits drop, reads files and folders (folders through webkitGetAsEntry), and resolves with the batch's files after addedfiles. Call it synchronously from the event listener: the browser clears the items afterwards.

Parameters ​

ParameterType
event{ dataTransfer?: | DataTransferLike | null; }
event.dataTransfer?| DataTransferLike | null

Returns ​

Promise<AnyDropFile[]>

Inherited from ​

AnyDropCore.drop


emit() ​

ts
emit<K>(event, ...args): this;

Defined in: ui/src/AnyDrop.ts:318

Dispatches anydrop:<event> on the element too (detail: { args }).

Type Parameters ​

Type Parameter
K extends keyof AnyDropEvents

Parameters ​

ParameterType
eventK
...argsAnyDropEvents[K]

Returns ​

this

Overrides ​

AnyDropCore.emit


enable() ​

ts
enable(): void;

Defined in: ui/src/AnyDrop.ts:388

Clears disabled.

Returns ​

void

Overrides ​

AnyDropCore.enable


enqueueFile() ​

ts
enqueueFile(file): void;

Defined in: core/src/AnyDropCore.ts:941

Queues an added, accepted file.

Parameters ​

ParameterType
fileAnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore.enqueueFile


enqueueFiles() ​

ts
enqueueFiles(files): void;

Defined in: core/src/AnyDropCore.ts:957

Queues several added, accepted files (with autoQueue: false).

Parameters ​

ParameterType
filesAnyDropFile[]

Returns ​

void

Inherited from ​

AnyDropCore.enqueueFiles


exportErrors() ​

ts
exportErrors(format?): string;

Defined in: core/src/AnyDropCore.ts:522

The error list as JSON or CSV (RFC 4180).

Parameters ​

ParameterTypeDefault value
format?"json" | "csv"'json'

Returns ​

string

Inherited from ​

AnyDropCore.exportErrors


filesize() ​

ts
filesize(size): string;

Defined in: core/src/AnyDropCore.ts:505

Size text for a byte count: '<strong>1.5</strong> MB'.

Parameters ​

ParameterType
sizenumber

Returns ​

string

Inherited from ​

AnyDropCore.filesize


getAcceptedFiles() ​

ts
getAcceptedFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:463

Files accepted by validation.

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getAcceptedFiles


getActiveFiles() ​

ts
getActiveFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:498

Files in queued, uploading or paused.

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getActiveFiles


getAddedFiles() ​

ts
getAddedFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:478

Files with status added.

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getAddedFiles


getConnectionState() ​

ts
getConnectionState(): ConnectionState;

Defined in: core/src/AnyDropCore.ts:737

The connection as seen by the lifecycle code: browser offline, no answer from the server, or fine.

Returns ​

ConnectionState

Inherited from ​

AnyDropCore.getConnectionState


getErrors() ​

ts
getErrors(): ErrorEntry[];

Defined in: core/src/AnyDropCore.ts:512

A copy of the error list: one entry per file currently in error.

Returns ​

ErrorEntry[]

Inherited from ​

AnyDropCore.getErrors


getFile() ​

ts
getFile(id): 
  | AnyDropFile
  | undefined;

Defined in: core/src/AnyDropCore.ts:458

A file by its id.

Parameters ​

ParameterType
idstring

Returns ​

| AnyDropFile | undefined

Inherited from ​

AnyDropCore.getFile


getFilesWithStatus() ​

ts
getFilesWithStatus(status): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:473

Files with the given status.

Parameters ​

ParameterType
statusFileStatus

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getFilesWithStatus


getFolder() ​

ts
getFolder(path): FolderNode | undefined;

Defined in: core/src/AnyDropCore.ts:453

A folder node by path, for example getFolder('Photos/2024').

Parameters ​

ParameterType
pathstring

Returns ​

FolderNode | undefined

Inherited from ​

AnyDropCore.getFolder


getOption() ​

Call Signature ​

ts
getOption<K>(name): AnyDropOptions[K];

Defined in: ui/src/AnyDrop.ts:331

Reads the current value of an option.

Type Parameters ​
Type Parameter
K extends keyof AnyDropEvents | keyof AnyDropCoreOptions<AnyDropCore>
Parameters ​
ParameterType
nameK
Returns ​

AnyDropOptions[K]

Overrides ​

AnyDropCore.getOption

Call Signature ​

ts
getOption<K>(name): AnyDropUIOptions[K];

Defined in: ui/src/AnyDrop.ts:332

Type Parameters ​
Type Parameter
K extends keyof AnyDropUIOptions
Parameters ​
ParameterType
nameK
Returns ​

AnyDropUIOptions[K]

Overrides ​

AnyDropCore.getOption


getPausedFiles() ​

ts
getPausedFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:493

Files with status paused.

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getPausedFiles


getQueuedFiles() ​

ts
getQueuedFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:483

Files with status queued.

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getQueuedFiles


getRejectedFiles() ​

ts
getRejectedFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:468

Files rejected by validation.

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getRejectedFiles


getTree() ​

ts
getTree(): FolderNode;

Defined in: core/src/AnyDropCore.ts:448

The virtual root folder (path: ''): top-level folders and loose files. Live object.

Returns ​

FolderNode

Inherited from ​

AnyDropCore.getTree


getUploadingFiles() ​

ts
getUploadingFiles(): AnyDropFile[];

Defined in: core/src/AnyDropCore.ts:488

Files in uploading (paused files are not included).

Returns ​

AnyDropFile[]

Inherited from ​

AnyDropCore.getUploadingFiles


hasListeners() ​

ts
hasListeners<K>(event): boolean;

Defined in: core/src/events/emitter.ts:76

Whether anyone listens to event (lets hot paths skip building payloads).

Type Parameters ​

Type Parameter
K extends keyof AnyDropEvents

Parameters ​

ParameterType
eventK

Returns ​

boolean

Inherited from ​

AnyDropCore.hasListeners


off() ​

ts
off<K>(event?, fn?): this;

Defined in: core/src/events/emitter.ts:42

off() removes every listener, off(event) every listener of one event. Also matches once() listeners.

Type Parameters ​

Type Parameter
K extends keyof AnyDropEvents

Parameters ​

ParameterType
event?K
fn?Listener<AnyDropEvents[K]>

Returns ​

this

Inherited from ​

AnyDropCore.off


on() ​

ts
on<K>(event, fn): Unsubscribe<AnyDrop>;

Defined in: core/src/AnyDropCore.ts:310

Adds a listener; returns a function that removes it (chainable: .on(), .once()). No-op after destroy().

Type Parameters ​

Type Parameter
K extends keyof AnyDropEvents

Parameters ​

ParameterType
eventK
fnListener<AnyDropEvents[K]>

Returns ​

Unsubscribe<AnyDrop>

Inherited from ​

AnyDropCore.on


once() ​

ts
once<K>(event, fn): Unsubscribe<AnyDrop>;

Defined in: core/src/AnyDropCore.ts:317

Adds a listener that runs once. Returns a function that removes it.

Type Parameters ​

Type Parameter
K extends keyof AnyDropEvents

Parameters ​

ParameterType
eventK
fnListener<AnyDropEvents[K]>

Returns ​

Unsubscribe<AnyDrop>

Inherited from ​

AnyDropCore.once


onListenerError() ​

ts
protected onListenerError(error): void;

Defined in: core/src/events/emitter.ts:82

Called when a listener throws. Overridable (tests).

Parameters ​

ParameterType
errorunknown

Returns ​

void

Inherited from ​

AnyDropCore.onListenerError


paste() ​

ts
paste(event): Promise<AnyDropFile[]>;

Defined in: core/src/AnyDropCore.ts:393

Handles a paste event. Text-only pastes add nothing.

Parameters ​

ParameterType
event{ clipboardData?: | DataTransferLike | null; }
event.clipboardData?| DataTransferLike | null

Returns ​

Promise<AnyDropFile[]>

Inherited from ​

AnyDropCore.paste


pause() ​

ts
pause(): void;

Defined in: core/src/AnyDropCore.ts:580

Pauses every file (paused({ scope: 'all', reason: 'user' })).

Returns ​

void

Inherited from ​

AnyDropCore.pause


pauseFile() ​

ts
pauseFile(file): void;

Defined in: core/src/AnyDropCore.ts:612

Pauses one file (the file or its id).

Parameters ​

ParameterType
filestring | AnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore.pauseFile


pauseFolder() ​

ts
pauseFolder(path): void;

Defined in: core/src/AnyDropCore.ts:594

Pauses every file under a folder, also files added to it later. Unknown paths are ignored.

Parameters ​

ParameterType
pathstring

Returns ​

void

Inherited from ​

AnyDropCore.pauseFolder


processFile() ​

ts
processFile(file): void;

Defined in: core/src/AnyDropCore.ts:1005

Starts one queued file now, even beyond parallelUploads.

Parameters ​

ParameterType
fileAnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore.processFile


processFiles() ​

ts
processFiles(files): void;

Defined in: core/src/AnyDropCore.ts:983

Starts these queued files now, even beyond parallelUploads. Files of a batch that is still open start when it closes. With uploadMultiple, the files of one batch share one request.

Parameters ​

ParameterType
filesAnyDropFile[]

Returns ​

void

Inherited from ​

AnyDropCore.processFiles


processQueue() ​

ts
processQueue(): void;

Defined in: core/src/AnyDropCore.ts:967

Starts queued files until parallelUploads files are uploading. Files start in add order; a batch's manifest is sent before its first file. Without a url, nothing starts. Called while a batch is still being read, it also runs when that batch closes, so its files are included.

Returns ​

void

Inherited from ​

AnyDropCore.processQueue


reconnect() ​

ts
reconnect(): void;

Defined in: core/src/AnyDropCore.ts:750

"Retry now": probes at once while the state is unreachable, and clears an offline pause the browser no longer reports. Does nothing when online. Unlike resume(), user pauses stay.

Returns ​

void

Inherited from ​

AnyDropCore.reconnect


removeAllFiles() ​

ts
removeAllFiles(cancelIfNecessary?): void;

Defined in: core/src/AnyDropCore.ts:1087

Removes every file that is not uploading, or every file when cancelIfNecessary is true. Emits removedfile per file, removedfolder for every folder left without files (also folders dropped empty), then reset.

Parameters ​

ParameterTypeDefault value
cancelIfNecessary?booleanfalse

Returns ​

void

Inherited from ​

AnyDropCore.removeAllFiles


removeFile() ​

ts
removeFile(file): void;

Defined in: ui/src/AnyDrop.ts:369

Removes a file; cancels it first when it is uploading.

Parameters ​

ParameterType
fileAnyDropFile

Returns ​

void

Overrides ​

AnyDropCore.removeFile


resolveOption() ​

ts
resolveOption<T>(option, ...args): T;

Defined in: core/src/AnyDropCore.ts:325

Calls a function option with this = the instance, else returns it.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
optionT | ((...args) => T)
...argsunknown[]

Returns ​

T

Inherited from ​

AnyDropCore.resolveOption


resume() ​

ts
resume(): void;

Defined in: core/src/AnyDropCore.ts:586

Clears the instance pause and every system reason (offline, hidden). Folder and file pauses stay.

Returns ​

void

Inherited from ​

AnyDropCore.resume


resumeFile() ​

ts
resumeFile(file): void;

Defined in: core/src/AnyDropCore.ts:621

Clears a file's own pause (a paused folder or instance still holds it).

Parameters ​

ParameterType
filestring | AnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore.resumeFile


resumeFolder() ​

ts
resumeFolder(path): void;

Defined in: core/src/AnyDropCore.ts:603

Clears a folder's own pause. Files stay paused while an ancestor, the instance or the file itself is paused.

Parameters ​

ParameterType
pathstring

Returns ​

void

Inherited from ​

AnyDropCore.resumeFolder


retryFailedOnly() ​

ts
retryFailedOnly(folderPath?): number;

Defined in: core/src/AnyDropCore.ts:531

Re-queues the files in error (under folderPath, or all) that can be retried: everything but validation rejections. Done chunks are kept; chunkStatusUrl is asked first when set; a failed batch manifest is sent again (same sessionId). Returns the number of files re-queued.

Parameters ​

ParameterType
folderPath?string

Returns ​

number

Inherited from ​

AnyDropCore.retryFailedOnly


retryFile() ​

ts
retryFile(file): boolean;

Defined in: core/src/AnyDropCore.ts:559

Re-queues one failed file (the file or its id) like retryFailedOnly. Returns whether it was re-queued.

Parameters ​

ParameterType
filestring | AnyDropFile

Returns ​

boolean

Inherited from ​

AnyDropCore.retryFile


setOption() ​

Call Signature ​

ts
setOption<K>(name, value): void;

Defined in: ui/src/AnyDrop.ts:337

Changes an option (or an event handler given as an option) at runtime.

Type Parameters ​
Type Parameter
K extends | keyof AnyDropEvents | keyof AnyDropCoreOptions<AnyDropCore> | "_uuid" | "_random"
Parameters ​
ParameterType
nameK
valueAnyDropCoreConfig[K]
Returns ​

void

Overrides ​

AnyDropCore.setOption

Call Signature ​

ts
setOption<K>(name, value): void;

Defined in: ui/src/AnyDrop.ts:338

Type Parameters ​
Type Parameter
K extends keyof AnyDropUIOptions
Parameters ​
ParameterType
nameK
valueAnyDropUIOptions[K]
Returns ​

void

Overrides ​

AnyDropCore.setOption


unsubscribe() ​

ts
protected unsubscribe<K>(event, fn): Unsubscribe<AnyDrop>;

Defined in: core/src/events/emitter.ts:87

Builds the function returned by on()/once(). Protected for subclasses; do not shadow it.

Type Parameters ​

Type Parameter
K extends keyof AnyDropEvents

Parameters ​

ParameterType
eventK
fnListener<AnyDropEvents[K]>

Returns ​

Unsubscribe<AnyDrop>

Inherited from ​

AnyDropCore.unsubscribe


uploadFile() ​

ts
uploadFile(file): void;

Defined in: core/src/AnyDropCore.ts:1010

Alias of processFile. Overriding it changes nothing: use transport instead.

Parameters ​

ParameterType
fileAnyDropFile

Returns ​

void

Inherited from ​

AnyDropCore.uploadFile


uploadFiles() ​

ts
uploadFiles(files): void;

Defined in: core/src/AnyDropCore.ts:1015

Alias of processFiles.

Parameters ​

ParameterType
filesAnyDropFile[]

Returns ​

void

Inherited from ​

AnyDropCore.uploadFiles


confirm() ​

ts
static confirm(
   question, 
   accepted, 
   rejected?
): void;

Defined in: ui/src/AnyDrop.ts:167

Asks a question: window.confirm, overridable (for example with a dialog).

Parameters ​

ParameterType
questionstring
accepted() => void
rejected?() => void

Returns ​

void


discover() ​

ts
static discover(root?): AnyDrop[];

Defined in: ui/src/AnyDrop.ts:157

Attaches an instance to every .anydrop element that has none and whose AnyDrop.options[id] is not false. Returns the new instances. It only runs when called; the npm builds never call it by themselves.

Parameters ​

ParameterTypeDefault value
root?ParentNodedocument

Returns ​

AnyDrop[]


forElement() ​

ts
static forElement(element): AnyDrop;

Defined in: ui/src/AnyDrop.ts:173

The instance attached to an element.

Parameters ​

ParameterType
elementstring | HTMLElement

Returns ​

AnyDrop


isBrowserSupported() ​

ts
static isBrowserSupported(): boolean;

Defined in: ui/src/AnyDrop.ts:180

Whether the APIs the UI needs exist.

Returns ​

boolean


supportsFolderPicker() ​

ts
static supportsFolderPicker(): boolean;

Defined in: ui/src/AnyDrop.ts:195

Feature detection for the folder picker (no user-agent sniffing).

Returns ​

boolean

Released under the MIT License.