diff --git a/http/http.d.ts b/http/http.d.ts index 660eec6f4..e6b07ca32 100644 --- a/http/http.d.ts +++ b/http/http.d.ts @@ -1,17 +1,47 @@ - -declare module "http" { +declare module "http" { import image = require("image-source"); import promises = require("promises"); + /** + * Downloads the content from the specified URL as a string. + * @param url The URL to request from. + */ function getString(url: string): promises.Promise + + /** + * Downloads the content from the specified URL as a string. + * @param options An object that specifies various request options. + */ function getString(options: HttpRequestOptions): promises.Promise + /** + * Downloads the content from the specified URL as a string and returns its JSON.parse representation. + * @param url The URL to request from. + */ function getJSON(url: string): promises.Promise + + /** + * Downloads the content from the specified URL as a string and returns its JSON.parse representation. + * @param options An object that specifies various request options. + */ function getJSON(options: HttpRequestOptions): promises.Promise + /** + * Downloads the content from the specified URL and attempts to decode it as an image. + * @param url The URL to request from. + */ function getImage(url: string): promises.Promise + + /** + * Downloads the content from the specified URL and attempts to decode it as an image. + * @param options An object that specifies various request options. + */ function getImage(options: HttpRequestOptions): promises.Promise + /** + * Makes a generic http request using the provided options and returns a HttpResponse Object. + * @param options An object that specifies various request options. + */ function request(options: HttpRequestOptions): promises.Promise; interface HttpRequestOptions { @@ -31,6 +61,7 @@ declare module "http" { interface HttpContent { raw: any; toString: () => string; + // TODO: Isn't parseJSON better naming? toJSON sounds to me like we will return a string object toJSON: () => any; toImage: () => image.ImageSource; } diff --git a/http/http.impl.ts b/http/http.impl.ts index 743b2a097..028bc977a 100644 --- a/http/http.impl.ts +++ b/http/http.impl.ts @@ -6,9 +6,6 @@ import request = require("http/http-request"); declare var exports; require("utils/module-merge").merge(request, exports); -/** -* Gets string from url. -*/ export function getString(arg: any): promises.Promise { var d = promises.defer(); @@ -19,9 +16,6 @@ export function getString(arg: any): promises.Promise { return d.promise(); } -/** - * Gets JSON from url. - */ export function getJSON(arg: any): promises.Promise { var d = promises.defer(); @@ -32,10 +26,6 @@ export function getJSON(arg: any): promises.Promise { return d.promise(); } -/** - * Gets image from url. - */ - export function getImage(arg: any): promises.Promise { var d = promises.defer(); diff --git a/local-settings/local-settings.d.ts b/local-settings/local-settings.d.ts index 92568d0e4..076bae544 100644 --- a/local-settings/local-settings.d.ts +++ b/local-settings/local-settings.d.ts @@ -1,72 +1,56 @@  declare module "local-settings" { /** - * report does such key exist + * Checks whether such a key exists. + * @param key The key to check for. */ var hasKey: (key: string) => boolean; /** - * gets value of the key as boolean, user can provide default value in case there is no value for the key + * Gets a value (if existing) for a key as a Boolean Object. A default value can be provided in case there is no existing value. + * @param key The key to check for. + * @param defaultValue An optional value to be returned in case there is no existing value. */ var getBoolean: (key: string, defaultValue?: boolean) => boolean; /** - * gets value of the key as string, user can provide default value in case there is no value for the key + * Gets a value (if existing) for a key as a String Object. A default value can be provided in case there is no existing value. + * @param key The key to check for. + * @param defaultValue An optional value to be returned in case there is no existing value. */ var getString: (key: string, defaultValue?: string) => string; /** - * gets value of the key as string array, user can provide default value in case there is no value for the key - */ - var getStringArray: (key: string, defaultValue?: string[]) => string[]; - - /** - * gets value of the key as number (double), user can provide default value in case there is no value for the key + * Gets a value (if existing) for a key as a Number Object. A default value can be provided in case there is no existing value. + * @param key The key to check for. + * @param defaultValue An optional value to be returned in case there is no existing value. */ var getNumber: (key: string, defaultValue?: number) => number; /** - * gets value of the key as integer, user can provide default value in case there is no value for the key - */ - var getInt: (key: string, defaultValue?: number) => number; - - /** - * gets value of the key as long integer (not fully supported by JS), user can provide default value in case there is no value for the key - */ - var getLong: (key: string, defaultValue?: number) => number; - - /** - * sets value for a key as boolean + * Sets a Boolean Object for a key. + * @param key The key. + * @param value The value. */ var setBoolean: (key: string, value: boolean) => void; /** - * sets value for a key as string + * Sets a String Object for a key. + * @param key The key. + * @param value The value. */ var setString: (key: string, value: string) => void; /** - * sets value for a key as string array - */ - var setStringArray: (key: string, value: string[]) => void; - - /** - * sets value for a key as JS number (double) + * Sets a Number Object for a key. + * @param key The key. + * @param value The value. */ var setNumber: (key: string, value: number) => void; /** - * sets value for a key as integer - */ - var setInt: (key: string, value: number) => void; - - /** - * sets value for a key as long integer - */ - var setLong: (key: string, value: number) => void; - - /** - * removes a value for key + * Removes a value (if existing) for a key. + * @param key The key to check for. */ var remove: (key: string) => void; } \ No newline at end of file diff --git a/timer/timer.d.ts b/timer/timer.d.ts index a731cecd6..970f9a80e 100644 --- a/timer/timer.d.ts +++ b/timer/timer.d.ts @@ -1,7 +1,25 @@ /** - * Timer functions. - */ +* Calls a function after a specified delay. +* @param callback The function to be called. +* @param milliseconds The time to wait before the function is called. Defaults to 0. +*/ export declare function setTimeout(callback: Function, milliseconds?: number): number; + +/** +* Clears the delay set by a call to the setTimeout function. +* @param id The identifier returned by the previously called setTimeout() method. +*/ export declare function clearTimeout(id: number): void; + +/** +* Calls a function repeatedly with a delay between each call. +* @param callback The function to be called. +* @param milliseconds The delay between each function call. +*/ export declare function setInterval(callback: Function, milliseconds?: number): number; + +/** +* Clears repeated function which was set up by calling setInterval(). +* @param id The identifier returned by the setInterval() method. +*/ export declare function clearInterval(id: number): void;