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() {
|
FileReader.prototype.abort = function() {
|
||||||
this.readyState = FileReader.DONE;
|
this.readyState = FileReader.DONE;
|
||||||
|
this.result = null;
|
||||||
|
|
||||||
// set error
|
// set error
|
||||||
var error = new FileError();
|
var error = new FileError();
|
||||||
@ -406,15 +407,29 @@ FileWriter.DONE = 2;
|
|||||||
* Abort writing file.
|
* Abort writing file.
|
||||||
*/
|
*/
|
||||||
FileWriter.prototype.abort = function() {
|
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 abort callback
|
||||||
if (typeof this.onabort == "function") {
|
if (typeof this.onabort == "function") {
|
||||||
var evt = File._createEvent("abort", this);
|
var evt = File._createEvent("abort", this);
|
||||||
this.onabort(evt);
|
this.onabort(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.readyState = FileWriter.DONE;
|
||||||
|
|
||||||
// TODO: Anything else to do? Maybe sent to native?
|
// 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) {
|
FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
||||||
|
Loading…
Reference in New Issue
Block a user