Simm Upload - techbasejs/techbase GitHub Wiki
Install
npm install simm-uploader
import firebaseChat from 'simm-uploader';
const UploadOptions = {
layout: 'basic', // basic or advanced, basic is simple layout, advanced is full-feature but it's complex layout.
target: '#inputFile',
accept: 'image/png,image/jpeg',
disabled: false,
isMultiple: false,
autoUpload: false,
dragToUpload: false,
driver: 'local' // local, s3,
hooks: {
onPreview: (file) => {}, // hook function when clicking the uploaded files
onRemove: (file, fileList) => {}, // hook function when files are removed
onSuccess: (response, file, fileList) => {}, // hook function when uploaded successfully
onError: (err, file, fileList) => {}, // hook function when some errors occurs
onProgress: (event, file, fileList) => {}, // hook function when some progress occurs
onChange: (file, fileList) => {}, // hook function when select file or upload file success or upload file fail
beforeUpload: (file) => {}, // hook function before uploading with the file to be uploaded as its parameter. If false is returned or a Promise is returned and then is rejected, uploading will be aborted
beforeRemove: (file, fileList) => {}, // hook function before removing a file with the file and file list as its parameters. If false is returned or a Promise is returned and then is rejected, removing will be aborted.
}
};
class SimmUploader {
constructor(private options: UploadOptions) {}
render() {} // handle logic render layout
submit() {} // handle logic when submit upload file
setFileList () {} // handle logic set list File to display
clearFiles () {} // clear the uploaded file list
}