mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
FileWriter should use its own states object.
This commit is contained in:
parent
0ed522481f
commit
eff7c92dae
@ -349,6 +349,11 @@ function FileWriter() {
|
|||||||
this.oncomplete = null;
|
this.oncomplete = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// States
|
||||||
|
FileWriter.EMPTY = 0;
|
||||||
|
FileWriter.LOADING = 1;
|
||||||
|
FileWriter.DONE = 2;
|
||||||
|
|
||||||
FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
||||||
if (bAppend != true) {
|
if (bAppend != true) {
|
||||||
bAppend = false; // for null values
|
bAppend = false; // for null values
|
||||||
@ -357,7 +362,7 @@ FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
|||||||
this.fileName = file;
|
this.fileName = file;
|
||||||
|
|
||||||
// LOADING state
|
// LOADING state
|
||||||
this.readyState = FileReader.LOADING;
|
this.readyState = FileWriter.LOADING;
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
@ -368,7 +373,7 @@ FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
|||||||
function(r) {
|
function(r) {
|
||||||
|
|
||||||
// If DONE (cancelled), then don't do anything
|
// If DONE (cancelled), then don't do anything
|
||||||
if (me.readyState == FileReader.DONE) {
|
if (me.readyState == FileWriter.DONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +381,7 @@ FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
|||||||
me.result = r;
|
me.result = r;
|
||||||
|
|
||||||
// DONE state
|
// DONE state
|
||||||
me.readyState = FileReader.DONE;
|
me.readyState = FileWriter.DONE;
|
||||||
|
|
||||||
// If oncomplete callback
|
// If oncomplete callback
|
||||||
if (typeof me.oncomplete == "function") {
|
if (typeof me.oncomplete == "function") {
|
||||||
@ -389,7 +394,7 @@ FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
|||||||
function(e) {
|
function(e) {
|
||||||
|
|
||||||
// If DONE (cancelled), then don't do anything
|
// If DONE (cancelled), then don't do anything
|
||||||
if (me.readyState == FileReader.DONE) {
|
if (me.readyState == FileWriter.DONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +402,7 @@ FileWriter.prototype.writeAsText = function(file, text, bAppend) {
|
|||||||
me.error = e;
|
me.error = e;
|
||||||
|
|
||||||
// DONE state
|
// DONE state
|
||||||
me.readyState = FileReader.DONE;
|
me.readyState = FileWriter.DONE;
|
||||||
|
|
||||||
// If onerror callback
|
// If onerror callback
|
||||||
if (typeof me.onerror == "function") {
|
if (typeof me.onerror == "function") {
|
||||||
|
Loading…
Reference in New Issue
Block a user