Fixed local, roaming and temp definitions on WinJS.Application object. These should be instances on IOHelper as defined in WinJS.

This commit is contained in:
Anand Prakash
2014-04-27 17:29:43 -07:00
parent 7631e9eee4
commit 1d55f70e34

161
winjs/winjs.d.ts vendored
View File

@@ -25,7 +25,49 @@ and limitations under the License.
**/
interface Element {
winControl: any; // TODO: This should be control?
}/**
}
/**
* Utility class for easy access to operations on application folders
**/
interface IOHelper {
/**
* Instance of the currently wrapped application folder
**/
folder: Windows.Storage.StorageFolder;
/**
* Determines whether the specified file exists in the folder.
* @param filename The name of the file.
* @returns A promise that completes with a value of either true (if the file exists) or false.
**/
exists(filename: string): WinJS.Promise<boolean>;
/**
* Reads the specified file. If the file doesn't exist, the specified default value is returned.
* @param fileName The file to read from.
* @param def The default value to be returned if the file failed to open.
* @returns A promise that completes with a value that is either the contents of the file, or the specified default value.
**/
readText(fileName: string, def?: string): WinJS.Promise<string>;
/**
* Deletes a file from the folder.
* @param fileName The file to be deleted.
* @returns A promise that is fulfilled when the file has been deleted.
**/
remove(fileName: string): WinJS.Promise<void>;
/**
* Writes the specified text to the specified file.
* @param fileName The name of the file.
* @param text The content to be written to the file.
* @returns A promise that completes with a value that is the number of characters written.
**/
writeText(fileName: string, text: string): WinJS.Promise<void>;
}
/**
* Provides application-level functionality, for example activation, storage, and application events.
**/
declare module WinJS.Application {
@@ -34,128 +76,23 @@ declare module WinJS.Application {
/**
* The local storage of the application.
**/
var local: {
//#region Methods
/**
* Determines whether the specified file exists in the folder.
* @param filename The name of the file.
* @returns A promise that completes with a value of either true (if the file exists) or false.
**/
exists(filename: string): Promise<boolean>;
/**
* Reads the specified file. If the file doesn't exist, the specified default value is returned.
* @param fileName The file to read from.
* @param def The default value to be returned if the file failed to open.
* @returns A promise that completes with a value that is either the contents of the file, or the specified default value.
**/
readText(fileName: string, def?: string): Promise<string>;
/**
* Deletes a file from the folder.
* @param fileName The file to be deleted.
* @returns A promise that is fulfilled when the file has been deleted.
**/
remove(fileName: string): Promise<void>;
/**
* Writes the specified text to the specified file.
* @param fileName The name of the file.
* @param text The content to be written to the file.
* @returns A promise that completes with a value that is the number of characters written.
**/
writeText(fileName: string, text: string): Promise<void>;
//#endregion Methods
};
var local: IOHelper;
/**
* The roaming storage of the application.
**/
var roaming: {
//#region Methods
var roaming: IOHelper;
/**
* Determines whether the specified file exists in the folder.
* @param filename The name of the file.
* @returns A promise that completes with a value of either true (if the file exists) or false.
**/
exists(filename: string): Promise<boolean>;
/**
* Reads the specified file. If the file doesn't exist, the specified default value is returned.
* @param fileName The file to read from.
* @param def The default value to be returned if the file failed to open.
* @returns A promise that completes with a value that is either the contents of the file, or the specified default value.
**/
readText(fileName: string, def?: string): Promise<string>;
/**
* Deletes a file from the folder.
* @param fileName The file to be deleted.
* @returns A promise that is fulfilled when the file has been deleted.
**/
remove(fileName: string): Promise<void>;
/**
* Writes the specified text to the specified file.
* @param fileName The name of the file.
* @param text The content to be written to the file.
* @returns A promise that completes with a value that is the number of characters written.
**/
writeText(fileName: string, text: string): Promise<void>;
//#endregion Methods
};
/**
* The temp storage of the application.
**/
var temp: IOHelper;
/**
* An object used for storing app information that can be used to restore the app's state after it has been suspended and then resumed. Data that can usefully be contained in this object includes the current navigation page or any information the user has added to the input controls on the page. You should not add information about customization (for example colors) or user-defined lists of content.
**/
var sessionState: any;
/**
* The temp storage of the application.
**/
var temp: {
//#region Methods
/**
* Determines whether the specified file exists in the folder.
* @param filename The name of the file.
* @returns A promise that completes with a value of either true (if the file exists) or false.
**/
exists(filename: string): Promise<boolean>;
/**
* Reads the specified file. If the file doesn't exist, the specified default value is returned.
* @param fileName The file to read from.
* @param def The default value to be returned if the file failed to open.
* @returns A promise that completes with a value that is either the contents of the file, or the specified default value.
**/
readText(fileName: string, def?: string): Promise<string>;
/**
* Deletes a file from the folder.
* @param fileName The file to be deleted.
* @returns A promise that is fulfilled when the file has been deleted.
**/
remove(fileName: string): Promise<void>;
/**
* Writes the specified text to the specified file.
* @param fileName The name of the file.
* @param text The text to write.
* @returns A Promise that completes with the number of bytes successfully written to the file.
**/
writeText(fileName: string, text: string): Promise<void>;
//#endregion Methods
};
//#endregion Objects
//#region Methods