mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Calling correct events from FileWriter.abort()
This commit is contained in:
parent
0dc64d2aa7
commit
46babe7a48
@ -161,6 +161,7 @@ FileReader.DONE = 2;
|
||||
*/
|
||||
FileReader.prototype.abort = function() {
|
||||
this.readyState = FileReader.DONE;
|
||||
this.result = null;
|
||||
|
||||
// set error
|
||||
var error = new FileError();
|
||||
@ -406,15 +407,29 @@ FileWriter.DONE = 2;
|
||||
* Abort writing file.
|
||||
*/
|
||||
FileWriter.prototype.abort = function() {
|
||||
this.readyState = FileWriter.DONE;
|
||||
// set error
|
||||
var error = new FileError();
|
||||
error.code = error.ABORT_ERR;
|
||||
this.error = error;
|
||||
|
||||
// If error callback
|
||||
if (typeof this.onerror == "function") {
|
||||
var evt = File._createEvent("error", this);
|
||||
this.onerror(evt);
|
||||
}
|
||||
// If abort callback
|
||||
if (typeof this.onabort == "function") {
|
||||
var evt = File._createEvent("abort", this);
|
||||
this.onabort(evt);
|
||||
}
|
||||
|
||||
// TODO: Anything else to do? Maybe sent to native?
|
||||
this.readyState = FileWriter.DONE;
|
||||
|
||||
// If load end callback
|
||||
if (typeof this.onloadend == "function") {
|
||||
var evt = File._createEvent("writeend", this);
|
||||
this.onloadend(evt);
|
||||
}
|
||||
};
|
||||
|
||||
FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
||||
|
Loading…
Reference in New Issue
Block a user