Skip to content

Commit a6edd11

Browse files
committed
Updated some APIs with @param defintions. Added .impl suffix to the ImageSource module.
1 parent 9dd3ba7 commit a6edd11

File tree

12 files changed

+112
-70
lines changed

12 files changed

+112
-70
lines changed

BCL.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
</TypeScriptCompile>
131131
<TypeScriptCompile Include="image-source\image-source.d.ts" />
132132
<TypeScriptCompile Include="image-source\image-source-native.d.ts" />
133-
<TypeScriptCompile Include="image-source\image-source.ts">
133+
<TypeScriptCompile Include="image-source\image-source.impl.ts">
134134
<DependentUpon>image-source.d.ts</DependentUpon>
135135
</TypeScriptCompile>
136136
<TypeScriptCompile Include="image-source\index.ts" />

Tests/image-source-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// ## Loading and saving images
1313
// </snippet>
1414

15-
import imageSource = require("image-source/image-source");
15+
import imageSource = require("image-source");
1616
import fs = require("file-system");
1717
import app = require("application");
1818
import TKUnit = require("Tests/TKUnit");

application/application.d.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,52 @@ declare module "application" {
55
* The main entry point event. This method is expected to return an instance of the root UI for the application.
66
* This will be an Activity extends for Android and a RootViewController for iOS.
77
*/
8-
function onLaunch(): any;
8+
export function onLaunch(): any;
99

1010
/**
1111
* This method will be called when the Application is suspended.
1212
*/
13-
function onSuspend();
13+
export function onSuspend();
1414

1515
/**
1616
* This method will be called when the Application is resumed after it has been suspended.
1717
*/
18-
function onResume();
18+
export function onResume();
1919

2020
/**
2121
* This method will be called when the Application is about to exit.
2222
*/
23-
function onExit();
23+
export function onExit();
2424

2525
/**
2626
* This method will be called when there is low memory on the target device.
2727
*/
28-
function onLowMemory();
28+
export function onLowMemory();
2929

3030
/**
3131
* This is the Android-specific application object instance.
3232
* Encapsulates methods and properties specific to the Android platform.
3333
* Will be undefined when TargetOS is iOS.
3434
*/
35-
var android: AndroidApplication;
35+
export var android: AndroidApplication;
3636

3737
/**
3838
* This is the iOS-specific application object instance.
3939
* Encapsulates methods and properties specific to the iOS platform.
4040
* Will be undefined when TargetOS is Android.
4141
*/
42-
var ios: iOSApplication;
42+
export var ios: iOSApplication;
43+
44+
/**
45+
* Entry point for the module. Initializes the Application singleton and hooks application lifecycle events.
46+
* @param nativeApp The instance of the platform Application object - e.g. android.app.Application
47+
*/
48+
export function init(nativeApp: any);
4349

4450
/**
4551
* The abstraction of an Android-specific application object.
4652
*/
47-
class AndroidApplication {
53+
export class AndroidApplication {
4854
/**
4955
* The android.app.Application object instance provided to the init of the module.
5056
*/
@@ -73,6 +79,7 @@ declare module "application" {
7379
/**
7480
* This method is called by the JavaScript Bridge when navigation to a new activity is triggered.
7581
* The return value of this method should be com.tns.NativeScriptActivity.extends implementation.
82+
* @param intent The android.content.Intent object for which the activity is required.
7683
*/
7784
public getActivity: (intent: android.content.Intent) => any;
7885

@@ -115,7 +122,7 @@ declare module "application" {
115122
/**
116123
* The abstraction of an iOS-specific application object.
117124
*/
118-
class iOSApplication {
125+
export class iOSApplication {
119126
/**
120127
* The root view controller for the application.
121128
*/
@@ -126,9 +133,4 @@ declare module "application" {
126133
*/
127134
public nativeApp: UIKit.UIApplication;
128135
}
129-
130-
/**
131-
* Entry point for the module. Initializes the Application singleton and hooks application lifecycle events.
132-
*/
133-
function init(nativeApp: any);
134136
}

camera/camera.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
declare module "camera" {
33

44
import promises = require("promises/promises");
5-
import imageSource = require("image-source/image-source");
5+
import imageSource = require("image-source");
66

77
enum CameraPosition {
88
FRONT = 0,

camera/camera.ios.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-

2-
import promises = require("promises/promises");
3-
import imageSource = require("image-source/image-source");
1+
import promises = require("promises/promises");
2+
import imageSource = require("image-source");
43
import types = require("camera/camera-types");
54

65
var imagePickerController;

console/console.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,49 @@
55
export declare class Console {
66
/**
77
* Begins counting a time span for a given name (key).
8+
* @param reportName The key for the operation.
89
*/
910
public time(reportName: string): void;
1011

1112
/**
1213
* Ends a previously started time span through the time method.
14+
* @param reportName The key for the operation. Must have an already started time(reportName) operation with the same key.
1315
*/
1416
public timeEnd(reportName: string): void;
1517

1618
/**
1719
* Asserts a boolean condition and prints a message in case the assert fails.
20+
* @param test A value that should not be Falsy.
21+
* @param message The message to be displayed in case the asserted value is Falsy.
22+
* @param formatParams Optional formatting parameters to be applied to the printed message.
1823
*/
1924
public assert(test: boolean, message: string, ...formatParams: any[]): void;
2025

2126
/**
2227
* Reports some information.
28+
* @param message The information message to be printed to the console.
29+
* @param formatParams Optional formatting parameters to be applied to the printed message.
2330
*/
2431
public info(message: any, ...formatParams: any[]): void;
2532

2633
/**
2734
* Reports a warning.
35+
* @param message The warning message to be printed to the console.
36+
* @param formatParams Optional formatting parameters to be applied to the printed message.
2837
*/
2938
public warn(message: any, ...formatParams: any[]): void;
3039

3140
/**
3241
* Reports an error.
42+
* @param message The error message to be printed to the console.
43+
* @param formatParams Optional formatting parameters to be applied to the printed message.
3344
*/
3445
public error(message: any, ...formatParams: any[]): void;
3546

3647
/**
3748
* Verbously logs a message.
49+
* @param message The message to be printed to the console.
50+
* @param formatParams Optional formatting parameters to be applied to the printed message.
3851
*/
3952
public log(message: any, ...formatParams: any[]): void;
4053

@@ -45,6 +58,7 @@ export declare class Console {
4558

4659
/**
4760
* Prints the state of the specified object to the console.
61+
* @param obj The object instance to be dumped.
4862
*/
4963
public dump(obj: any): void;
5064
}

file-system/file-system.d.ts

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare module "file-system" {
33

44
import promises = require("promises/promises");
55

6-
class FileSystemEntity {
6+
export class FileSystemEntity {
77
/**
88
* Gets the Date object specifying the last time this entity was modified.
99
*/
@@ -33,62 +33,71 @@ declare module "file-system" {
3333

3434
/**
3535
* Renames the current entity using the specified name.
36+
* @param newName The new name to be applied to the entity.
3637
*/
3738
public rename(newName: string): promises.Promise<any>;
3839
}
3940

40-
class File extends FileSystemEntity {
41+
export class File extends FileSystemEntity {
4142
/**
42-
* Checks whether a File with the specified path already exists.
43-
*/
43+
* Checks whether a File with the specified path already exists.
44+
* @param path The path to check for.
45+
*/
4446
public static exists(path: string): boolean;
4547

4648
/**
47-
* Gets the extension of the file.
48-
*/
49+
* Gets the extension of the file.
50+
*/
4951
public extension: string;
5052

5153
/**
52-
* Gets a value indicating whether the file is currently locked, meaning a background operation associated with this file is running.
53-
*/
54+
* Gets a value indicating whether the file is currently locked, meaning a background operation associated with this file is running.
55+
*/
5456
public isLocked: boolean;
5557

5658
/**
57-
* Gets or creates a File entity at the specified path.
58-
*/
59+
* Gets or creates a File entity at the specified path.
60+
* @param path The path to get/create the file at.
61+
*/
5962
public static fromPath(path: string): File;
6063

6164
/**
62-
* Reads the content of the file as a string using the specified encoding (defaults to UTF-8).
63-
*/
65+
* Reads the content of the file as a string using the specified encoding (defaults to UTF-8).
66+
* @param encoding An optional value specifying the preferred encoding (defaults to UTF-8).
67+
*/
6468
public readText(encoding?: string): promises.Promise<string>;
6569

6670
/**
67-
* Writes the provided string to the file, using the specified encoding (defaults to UTF-8).
68-
*/
71+
* Writes the provided string to the file, using the specified encoding (defaults to UTF-8).
72+
* @param content The content to be saved to the file.
73+
* @param encoding An optional value specifying the preferred encoding (defaults to UTF-8).
74+
*/
6975
public writeText(content: string, encoding?: string): promises.Promise<any>;
7076
}
7177

72-
class Folder extends FileSystemEntity {
78+
export class Folder extends FileSystemEntity {
7379
/**
74-
* Determines whether this instance is a KnownFolder (accessed through the KnownFolders object).
75-
*/
80+
* Determines whether this instance is a KnownFolder (accessed through the KnownFolders object).
81+
*/
7682
public isKnown: boolean;
7783

7884
/**
79-
* Gets or creates a Folder entity at the specified path.
80-
*/
85+
* Gets or creates a Folder entity at the specified path.
86+
* @param path The path to get/create the folder at.
87+
*/
8188
public static fromPath(path: string): Folder;
8289

8390
/**
84-
* Checks whether a Folder with the specified path already exists.
85-
*/
91+
* Checks whether a Folder with the specified path already exists.
92+
* @param path The path to check for.
93+
*/
8694
public static exists(path: string): boolean;
8795

8896
/**
89-
Checks whether this Folder contains an Entity with the specified name.
90-
The path of the folder is added to the name to resolve the complete path to check for.
91-
*/
97+
* Checks whether this Folder contains an Entity with the specified name.
98+
* The path of the folder is added to the name to resolve the complete path to check for.
99+
* @param name The name of the entity to check for.
100+
*/
92101
public contains(name: string): boolean;
93102

94103
/**
@@ -97,12 +106,14 @@ declare module "file-system" {
97106
public clear(): promises.Promise<any>;
98107

99108
/**
100-
* Gets or creates a File entity with the specified name within this Folder.
101-
*/
109+
* Gets or creates a File entity with the specified name within this Folder.
110+
* @param name The name of the file to get/create.
111+
*/
102112
public getFile(name: string): File;
103113

104114
/**
105115
* Gets or creates a Folder entity with the specified name within this Folder.
116+
* @param name The name of the folder to get/create.
106117
*/
107118
public getFolder(name: string): Folder;
108119

@@ -112,17 +123,16 @@ declare module "file-system" {
112123
public getEntities(): promises.Promise<Array<FileSystemEntity>>;
113124

114125
/**
115-
Enumerates all the top-level FileSystem entities residing within this folder.
116-
The first parameter is a callback that receives the current entity.
117-
If the callback returns false this will mean for the iteration to stop.
126+
* Enumerates all the top-level FileSystem entities residing within this folder.
127+
* @param onEntity A callback that receives the current entity. If the callback returns false this will mean for the iteration to stop.
118128
*/
119129
public eachEntity(onEntity: (entity: FileSystemEntity) => boolean);
120130
}
121131

122132
/**
123-
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
124-
*/
125-
module knownFolders {
133+
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
134+
*/
135+
export module knownFolders {
126136
/**
127137
* Gets the Documents folder available for the current application. This Folder is private for the application and not accessible from Users/External apps.
128138
*/
@@ -137,14 +147,16 @@ declare module "file-system" {
137147
/**
138148
* Enables path-specific operations like join, extension, etc.
139149
*/
140-
module path {
150+
export module path {
141151
/**
142-
* Normalizes a path, taking care of occurrances like ".." and "//"
152+
* Normalizes a path, taking care of occurrances like ".." and "//".
153+
* @param path The path to be normalized.
143154
*/
144155
export function normalize(path: string): string;
145156

146157
/**
147158
* Joins all the provided string components, forming a valid and normalized path.
159+
* @param paths An array of string components to be joined.
148160
*/
149161
export function join(...paths: string[]): string;
150162

http/http-common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import image = require("image-source/image-source");
1+
import image = require("image-source");
22
import promises = require("promises/promises");
33
import http = require("http");
44

http/http.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
declare module "http" {
3-
import image = require("image-source/image-source");
3+
import image = require("image-source");
44
import promises = require("promises/promises");
55

66
function getString(url: string): promises.Promise<string>

0 commit comments

Comments
 (0)