From c600a2b003728998494418cb3adac6f8a8d99abd Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Wed, 28 May 2014 15:28:47 +0300 Subject: [PATCH] Updated TypeScript definitions. Added features in the API Reference MD. --- application/application.d.ts | 35 +++++++++++++++--------------- local-settings/local-settings.d.ts | 16 +++++++------- location/location.d.ts | 2 +- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/application/application.d.ts b/application/application.d.ts index b8dee2a63..ec5818111 100644 --- a/application/application.d.ts +++ b/application/application.d.ts @@ -50,87 +50,86 @@ declare module "application" { /** * 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. */ - public nativeApp: android.app.Application; + nativeApp: android.app.Application; /** * 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. */ - public currentActivity: android.app.Activity; + currentActivity: android.app.Activity; /** * The main (start) Activity for the application. */ - public startActivity: android.app.Activity; + startActivity: android.app.Activity; /** * 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. * 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. */ - 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. */ - public onActivityDestroyed: (activity: android.app.Activity) => void; + onActivityDestroyed: (activity: android.app.Activity) => void; /** * 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. */ - public onActivityPaused: (activity: android.app.Activity) => void; + onActivityPaused: (activity: android.app.Activity) => void; /** * 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. */ - public onActivityStopped: (activity: android.app.Activity) => void; + onActivityStopped: (activity: android.app.Activity) => void; /** * 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. */ - export class iOSApplication { + interface iOSApplication { /** * 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. */ - public nativeApp: UIKit.UIApplication; + nativeApp: UIKit.UIApplication; } } \ No newline at end of file diff --git a/local-settings/local-settings.d.ts b/local-settings/local-settings.d.ts index 076bae544..4af9c94b0 100644 --- a/local-settings/local-settings.d.ts +++ b/local-settings/local-settings.d.ts @@ -4,53 +4,53 @@ declare module "local-settings" { * Checks whether such a key exists. * @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. * @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; + 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. * @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; + 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. * @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; + function getNumber(key: string, defaultValue?: number): number; /** * Sets a Boolean Object for a key. * @param key The key. * @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. * @param key The key. * @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. * @param key The key. * @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. * @param key The key to check for. */ - var remove: (key: string) => void; + function remove(key: string): void; } \ No newline at end of file diff --git a/location/location.d.ts b/location/location.d.ts index 701daae63..84fdaca8a 100644 --- a/location/location.d.ts +++ b/location/location.d.ts @@ -171,5 +171,5 @@ declare module "location" { * 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. */ - var getLocation: (options?: Options) => promises.Promise; + function getLocation(options?: Options): promises.Promise; } \ No newline at end of file