In my app, I require to simulate the MouseEvent
type drop
and add files to its dataTransfer
. My current approach is like this:
let dropEvent = new MouseEvent('drop', {
view: window,
bubbles: true,
cancelable: true
});
dropEvent.dataTransfer = {files: this.refs.inputFile.files};
this.refs.fileUploader.dispatchEvent(dropEvent);
The approach works on Chrome and Firefox but not on Safari. The error on Safari is:
TypeError: Attempted to assign to readonly property.
Can I have some feedbacks on doing it in a cross-browser supported manner?