Updated TypeScript definitions.

Added features in the API Reference MD.
This commit is contained in:
PanayotCankov
2014-05-28 15:28:47 +03:00
parent 282c57b821
commit c600a2b003
3 changed files with 26 additions and 27 deletions

View File

@@ -50,87 +50,86 @@ declare module "application" {
/** /**
* The abstraction of an Android-specific application object. * The abstraction of an Android-specific application object.
*/ */
export class AndroidApplication { interface AndroidApplication {
/** /**
* The android.app.Application object instance provided to the init of the module. * The android.app.Application object instance provided to the init of the module.
*/ */
public nativeApp: android.app.Application; nativeApp: android.app.Application;
/** /**
* The application android.content.Context object instance. * The application android.content.Context object instance.
*/ */
public context: android.content.Context; context: android.content.Context;
/** /**
* The currently active (loaded) android.app.Activity. This property is automatically updated upon Activity events. * The currently active (loaded) android.app.Activity. This property is automatically updated upon Activity events.
*/ */
public currentActivity: android.app.Activity; currentActivity: android.app.Activity;
/** /**
* The main (start) Activity for the application. * The main (start) Activity for the application.
*/ */
public startActivity: android.app.Activity; startActivity: android.app.Activity;
/** /**
* The name of the application package. * The name of the application package.
*/ */
public packageName: string; packageName: string;
/** /**
* This method is called by the JavaScript Bridge when navigation to a new activity is triggered. * This method is called by the JavaScript Bridge when navigation to a new activity is triggered.
* The return value of this method should be com.tns.NativeScriptActivity.extends implementation. * The return value of this method should be com.tns.NativeScriptActivity.extends implementation.
* @param intent The android.content.Intent object for which the activity is required.
*/ */
public getActivity: (intent: android.content.Intent) => any; getActivity: (intent: android.content.Intent) => any;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityCreated method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityCreated method.
*/ */
public onActivityCreated: (activity: android.app.Activity, bundle: android.os.Bundle) => void; onActivityCreated: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method.
*/ */
public onActivityDestroyed: (activity: android.app.Activity) => void; onActivityDestroyed: (activity: android.app.Activity) => void;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method.
*/ */
public onActivityStarted: (activity: android.app.Activity) => void; onActivityStarted: (activity: android.app.Activity) => void;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityPaused method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityPaused method.
*/ */
public onActivityPaused: (activity: android.app.Activity) => void; onActivityPaused: (activity: android.app.Activity) => void;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityResumed method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityResumed method.
*/ */
public onActivityResumed: (activity: android.app.Activity) => void; onActivityResumed: (activity: android.app.Activity) => void;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityStopped method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityStopped method.
*/ */
public onActivityStopped: (activity: android.app.Activity) => void; onActivityStopped: (activity: android.app.Activity) => void;
/** /**
* Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onSaveActivityState method. * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onSaveActivityState method.
*/ */
public onSaveActivityState: (activity: android.app.Activity, bundle: android.os.Bundle) => void; onSaveActivityState: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
} }
/** /**
* The abstraction of an iOS-specific application object. * The abstraction of an iOS-specific application object.
*/ */
export class iOSApplication { interface iOSApplication {
/** /**
* The root view controller for the application. * The root view controller for the application.
*/ */
public rootController: UIKit.UIViewController; rootController: UIKit.UIViewController;
/** /**
* The android.app.Application object instance provided to the init of the module. * The android.app.Application object instance provided to the init of the module.
*/ */
public nativeApp: UIKit.UIApplication; nativeApp: UIKit.UIApplication;
} }
} }

View File

@@ -4,53 +4,53 @@ declare module "local-settings" {
* Checks whether such a key exists. * Checks whether such a key exists.
* @param key The key to check for. * @param key The key to check for.
*/ */
var hasKey: (key: string) => boolean; function hasKey(key: string): boolean;
/** /**
* 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. * 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 key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value. * @param defaultValue An optional value to be returned in case there is no existing value.
*/ */
var getBoolean: (key: string, defaultValue?: boolean) => boolean; function getBoolean(key: string, defaultValue?: boolean): boolean;
/** /**
* 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. * 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 key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value. * @param defaultValue An optional value to be returned in case there is no existing value.
*/ */
var getString: (key: string, defaultValue?: string) => string; function getString(key: string, defaultValue?: string): string;
/** /**
* 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. * 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 key The key to check for.
* @param defaultValue An optional value to be returned in case there is no existing value. * @param defaultValue An optional value to be returned in case there is no existing value.
*/ */
var getNumber: (key: string, defaultValue?: number) => number; function getNumber(key: string, defaultValue?: number): number;
/** /**
* Sets a Boolean Object for a key. * Sets a Boolean Object for a key.
* @param key The key. * @param key The key.
* @param value The value. * @param value The value.
*/ */
var setBoolean: (key: string, value: boolean) => void; function setBoolean(key: string, value: boolean): void;
/** /**
* Sets a String Object for a key. * Sets a String Object for a key.
* @param key The key. * @param key The key.
* @param value The value. * @param value The value.
*/ */
var setString: (key: string, value: string) => void; function setString(key: string, value: string): void;
/** /**
* Sets a Number Object for a key. * Sets a Number Object for a key.
* @param key The key. * @param key The key.
* @param value The value. * @param value The value.
*/ */
var setNumber: (key: string, value: number) => void; function setNumber(key: string, value: number): void;
/** /**
* Removes a value (if existing) for a key. * Removes a value (if existing) for a key.
* @param key The key to check for. * @param key The key to check for.
*/ */
var remove: (key: string) => void; function remove(key: string): void;
} }

View File

@@ -171,5 +171,5 @@ declare module "location" {
* However if you specify maximumAge and the location received is older it won't be received. * However if you specify maximumAge and the location received is older it won't be received.
* @param options An optional object specifying location update settings. * @param options An optional object specifying location update settings.
*/ */
var getLocation: (options?: Options) => promises.Promise<Location>; function getLocation(options?: Options): promises.Promise<Location>;
} }