mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-04-24 00:00:03 +08:00
594d03aa41
- feat(www): implement preprocessor for FormData instances - feat(www): implement API checks for multipart requests - feat(android): implement multipart requests - chore(specs): implement www specs for new prprocessor
40 lines
865 B
JavaScript
40 lines
865 B
JavaScript
module.exports = class FileReaderMock {
|
|
constructor() {
|
|
this.EMPTY = 0;
|
|
this.LOADING = 1;
|
|
this.DONE = 2;
|
|
|
|
this.error = null;
|
|
this.onabort = () => {};
|
|
this.onerror = () => {};
|
|
this.onload = () => {};
|
|
this.onloadend = () => {};
|
|
this.onloadstart = () => {};
|
|
this.onprogress = () => {};
|
|
this.readyState = this.EMPTY;
|
|
this.result = null;
|
|
}
|
|
|
|
readAsArrayBuffer(file) {
|
|
this.readyState = this.LOADING;
|
|
this.onloadstart();
|
|
this.onprogress();
|
|
this.result = file._buffer;
|
|
this.readyState = this.DONE;
|
|
this.onloadend();
|
|
this.onload();
|
|
}
|
|
|
|
readAsBinaryString() {
|
|
throw new Error('Not implemented in FileReaderMock.');
|
|
}
|
|
|
|
readAsDataUrl() {
|
|
throw new Error('Not implemented in FileReaderMock.');
|
|
}
|
|
|
|
readAsText() {
|
|
throw new Error('Not implemented in FileReaderMock.');
|
|
}
|
|
}
|