Selaa lähdekoodia

add definition for addFiles method (#3556)

* add definition for addFiles method

* Add basic doc entry for addFiles

Co-authored-by: Artur Paikin <artur@arturpaikin.com>
Matteo Padovano 2 vuotta sitten
vanhempi
commit
0788552554
2 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 4 0
      packages/@uppy/core/types/index.d.ts
  2. 4 0
      website/src/docs/core.md

+ 4 - 0
packages/@uppy/core/types/index.d.ts

@@ -325,6 +325,10 @@ export class Uppy {
     file: AddFileOptions<TMeta>
   ): string
 
+  addFiles<TMeta extends IndexedObject<any> = Record<string, unknown>>(
+    files: AddFileOptions<TMeta>[]
+  ): void
+
   removeFile(fileID: string, reason?: FileRemoveReason): void
 
   pauseResume(fileID: string): boolean

+ 4 - 0
website/src/docs/core.md

@@ -478,6 +478,10 @@ If `uppy.opts.autoProceed === true`, Uppy will begin uploading automatically whe
 >
 > Sometimes you might need to mark some files as “already uploaded”, so that the user sees them, but they won’t actually be uploaded by Uppy. This can be achieved by [looping through files and setting `uploadComplete: true, uploadStarted: true` on them](https://github.com/transloadit/uppy/issues/1112#issuecomment-432339569)
 
+### `uppy.addFiles(fileObjectArray)`
+
+Add many new files to Uppy’s internal state at once. Like `uppy.addFile`, but mostly intended for UI plugins, to speed up the UIs. See `uppy.addFile` for the example of the file object shape.
+
 ### `uppy.removeFile(fileID)`
 
 Remove a file from Uppy.