Store file format (text or binary) in file object.
This commit is contained in:
parent
79e344187d
commit
6169e39450
@ -14,8 +14,15 @@ OV.File = class
|
||||
this.name = OV.GetFileName (file.name);
|
||||
this.extension = OV.GetFileExtension (file.name);
|
||||
}
|
||||
this.format = null;
|
||||
this.content = null;
|
||||
}
|
||||
|
||||
SetContent (format, content)
|
||||
{
|
||||
this.format = format;
|
||||
this.content = content;
|
||||
}
|
||||
};
|
||||
|
||||
OV.FileList = class
|
||||
@ -130,9 +137,14 @@ OV.FileList = class
|
||||
|
||||
GetFileContent (file, complete)
|
||||
{
|
||||
if (file.content !== null) {
|
||||
complete ();
|
||||
return;
|
||||
}
|
||||
let format = this.GetFileFormat (file);
|
||||
let callbacks = {
|
||||
success : (content) => {
|
||||
file.content = content;
|
||||
file.SetContent (format, content);
|
||||
},
|
||||
error : () => {
|
||||
|
||||
@ -141,11 +153,6 @@ OV.FileList = class
|
||||
complete ();
|
||||
}
|
||||
};
|
||||
if (file.content !== null) {
|
||||
complete ();
|
||||
return;
|
||||
}
|
||||
let format = this.GetFileFormat (file);
|
||||
if (file.source === OV.FileSource.Url) {
|
||||
OV.RequestUrl (file.fileUrl, format, callbacks);
|
||||
} else if (file.source === OV.FileSource.File) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user