diff --git a/filesystem/filesystem-tests.ts b/filesystem/filesystem-tests.ts index 8f175db98..9eb6fbaae 100644 --- a/filesystem/filesystem-tests.ts +++ b/filesystem/filesystem-tests.ts @@ -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); }); } diff --git a/filesystem/filesystem.d.ts b/filesystem/filesystem.d.ts index 8b20b113c..1b76846b4 100644 --- a/filesystem/filesystem.d.ts +++ b/filesystem/filesystem.d.ts @@ -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. */