forked from 23/resumable.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Add option to distinguish between different kind of files #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adi64
merged 17 commits into
main
from
5-add-option-to-distinguish-between-different-kind-of-files
Mar 20, 2023
Merged
Add option to distinguish between different kind of files #11
adi64
merged 17 commits into
main
from
5-add-option-to-distinguish-between-different-kind-of-files
Mar 20, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0c0cc1e
to
16f2f0c
Compare
…faultFileCategory
8a7e5df
to
9a3e31e
Compare
adi64
reviewed
Mar 15, 2023
adi64
reviewed
Mar 16, 2023
9a3e31e
to
b7b6141
Compare
adi64
approved these changes
Mar 20, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Merge after #10
This adds the option to add "file categories" to the resumable object.
The categories can be set when creating the resumable instance, by passing an array of strings as the
fileCategories
parameter of the options object. Each string represents one file category (it's the name of the category).Afterwards all functions that add files to the instance accept an optional
fileCategory
parameter. These functions areassignBrowse
/assignDrop
(all files added via the dom elements get the same category), respectivehandleChangeEvent
/handleDropEvent
andaddFile
/addFiles
.Additionally all related events (e.g.
fileProcessingBegin
) and all related helper functions (generateUniqueIdentifier
,validateFiles
+ all added file validators) get the corresponding file category.If no category is passed the
defaultFileCategory
is used. It can also be set via an options parameter and is calleddefault
by default. In this case, resumable should behave exactly like before.The biggest change in the inner workings of the package is that the files are now not all stored in one
files
array, but in multiple array which are all added to thefiles
object. This object has one entry per file category (and each entry is an array with all files of that category).Two changes in the bundling are also done in this PR:
I added the
copy-webpack-plugin
to copy over thetypes/types.d.ts
file into the dist directory. It was previously missing, so that some files in the dist directory had unresolved type imports.Additionally there is now a second output of the webpack run, the
helpers.js
file. This allows for import of the helper functions used by resumable. This is especially handy if you want to set an own function to generate the unique identifier but want it to be based on the same algortihm used by resumable.