Merge pull request #3822 from randombk/filesystem-fix

filesystem: Quality-of-life changes
This commit is contained in:
Masahiro Wakame
2015-03-09 10:55:42 +09:00
2 changed files with 25 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ declare function writeDataToLogFile(fileWriter:FileWriterSync): void;
function useAsyncFS(fs:FileSystem):void {
// see getAsText example in [FILE-API-ED].
fs.root.getFile("already_there.txt", null, function (f:FileEntry): void{
fs.root.getFile("already_there.txt", null, function (f): void{
// In the example of the specification, there is a following code:
//
@@ -19,7 +19,7 @@ function useAsyncFS(fs:FileSystem):void {
});
// But now we can also write to the file; see [FILE-WRITER-ED].
fs.root.getFile("logFile", {create: true}, function (f:FileEntry): void{
fs.root.getFile("logFile", {create: true}, function (f): void{
f.createWriter(writeDataToLogFile);
});
}

View File

@@ -197,7 +197,7 @@ interface Entry {
* @param successCallback A callback that is called to return the parent Entry.
* @param errorCallback A callback that is called when errors happen.
*/
getParent(successCallback:EntryCallback, errorCallback?:ErrorCallback):void;
getParent(successCallback:DirectoryEntryCallback, errorCallback?:ErrorCallback):void;
}
/**
@@ -223,7 +223,7 @@ interface DirectoryEntry extends Entry {
* @param successCallback A callback that is called to return the File selected or created.
* @param errorCallback A callback that is called when errors happen.
*/
getFile(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void;
getFile(path:string, options?:Flags, successCallback?:FileEntryCallback, errorCallback?:ErrorCallback):void;
/**
* Creates or looks up a directory.
@@ -240,7 +240,7 @@ interface DirectoryEntry extends Entry {
* @param errorCallback A callback that is called when errors happen.
*
*/
getDirectory(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void;
getDirectory(path:string, options?:Flags, successCallback?:DirectoryEntryCallback, errorCallback?:ErrorCallback):void;
/**
* Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
@@ -307,6 +307,26 @@ interface EntryCallback {
(entry:Entry):void;
}
/**
* This interface is the callback used to look up FileEntry objects.
*/
interface FileEntryCallback {
/**
* @param entry
*/
(entry:FileEntry):void;
}
/**
* This interface is the callback used to look up DirectoryEntry objects.
*/
interface DirectoryEntryCallback {
/**
* @param entry
*/
(entry:DirectoryEntry):void;
}
/**
* When readEntries() succeeds, the following callback is made.
*/