Updated the API reference.

This commit is contained in:
PanayotCankov
2014-05-27 12:54:11 +03:00
parent d1570dbfcc
commit 0b056dd3db
5 changed files with 90 additions and 29 deletions

View File

@@ -335,9 +335,7 @@
<UsingTask TaskName="BuildTasks.CopyForPlatformBuildTask" AssemblyFile="../../Build/lib/BuildTasks.dll" />
<Target Name="AfterBuild">
<CopyForPlatformBuildTask TargetPlatform="$(TargetOS)" IncludeTests="$(CopyTests)" Platforms="iOS;Android" InputFiles="@(GeneratedJavascript)" DestinationFolder="$(OutputPath)\$(Configuration)\" JSConfigFile="$(JSConfig)" AppMainJSFile="$(JSMainFile)" ProjectDir="$(ProjectDir)" />
</Target>
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Documentation'">
<Exec Command="node ../../Documentation/Src/TypeScriptAPIExtractor/app.js @(TypeScriptCompile) $(IntermediateOutputPath)\api.xml" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="false" LogStandardErrorAsError="true" />
<Exec Condition=" '$(Configuration)' == 'Documentation'" Command="node ../../Documentation/Src/TypeScriptAPIExtractor/app.js @(TypeScriptCompile) $(IntermediateOutputPath)\api.xml" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="false" LogStandardErrorAsError="true" />
</Target>
<PropertyGroup>
<PostBuildEvent>

45
camera/camera.d.ts vendored
View File

@@ -4,17 +4,41 @@ declare module "camera" {
import promises = require("promises");
import imageSource = require("image-source");
/**
* Specifies a camera position on a device.
*/
enum CameraPosition {
/**
* The camera is located at the front of the device, facing the user.
*/
FRONT = 0,
/**
* The camera is located at the back of the device.
*/
BACK = 1,
}
/**
* Specifies a camera flash mode.
*/
enum FlashMode {
AUTO = 0, // default
/**
* Flash will be fired automatically when required.
*/
AUTO = 0,
/**
* The camera flash is enabled.
*/
ON = 1,
/**
* The camera flash is disabled.
*/
OFF = 2
}
/**
* Camera options for capture an image.
*/
interface Options {
/**
* Specifies which Camera to use.
@@ -28,12 +52,27 @@ declare module "camera" {
}
// TODO most of hardware related parts need to handle onPause and onResume of the calling activities
/**
* This class provides access to the device camera and photo libraries.
*/
class CameraManager {
/**
* Take a photo using the camera.
*/
takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any);
// options { useSavedPhotos: true }
// TODO: Create an interface with the pictrue from library options: { useSavedPhotos: true }
/**
* Requests an image from the user.
* The result may be a new photo taken or an existing image from the library.
*/
pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any);
}
var takePicture: (options?: Options) => promises.Promise<imageSource.ImageSource>;
/**
* Take a photo using the camera.
*/
function takePicture(options?: Options): promises.Promise<imageSource.ImageSource>;
}

37
http/http.d.ts vendored
View File

@@ -44,6 +44,9 @@
*/
function request(options: HttpRequestOptions): promises.Promise<HttpResponse>;
/**
* Provides options for the http requests.
*/
interface HttpRequestOptions {
/**
* Gets or sets the request url.
@@ -71,42 +74,48 @@
timeout?: number;
}
/**
* Encapsulates HTTP-response information from an HTTP-request.
*/
interface HttpResponse {
/**
* Gets the response status code.
*/
* Gets the response status code.
*/
statusCode: number;
/**
* Gets the response headers.
*/
* Gets the response headers.
*/
headers: any;
/**
* Gets the response content.
*/
* Gets the response content.
*/
content?: HttpContent;
}
/**
* Encapsulates the content of an HttpResponse.
*/
interface HttpContent {
/**
* Gets the response body as raw data.
*/
* Gets the response body as raw data.
*/
raw: any;
/**
* Gets the response body as string.
*/
* Gets the response body as string.
*/
toString: () => string;
/**
* Gets the response body as JSON object.
*/
* Gets the response body as JSON object.
*/
toJSON: () => any;
/**
* Gets the response body as ImageSource.
*/
* Gets the response body as ImageSource.
*/
toImage: () => image.ImageSource;
}
}

View File

@@ -6,7 +6,14 @@ declare module "image-source" {
* Defines the recognized image formats.
*/
export enum ImageFormat {
/**
* The W3C Portable Network Graphics (PNG) image format.
*/
PNG,
/**
* The Joint Photographic Experts Group (JPEG) image format.
*/
JPEG,
}

View File

@@ -2,10 +2,19 @@
declare module "location" {
import promises = require("promises");
/**
* Specifies common accuracy values.
*/
enum Accuracy {
// in meters
ANY,
HIGH,
/**
* The default accuracy. About 300 meters.
*/
ANY = 300,
/**
* High accuracy. About 3 meters.
*/
HIGH = 3,
}
// For future usage
@@ -71,6 +80,9 @@ declare module "location" {
ios: CoreLocation.CLLocation;
}
/**
* Provides options for location monitoring.
*/
export interface Options {
/**
* Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH
@@ -134,8 +146,6 @@ declare module "location" {
*/
isStarted: boolean;
// monitoring
/**
* Starts location monitoring.
* @param onLocation A function that will be called upon every location update received.
@@ -145,14 +155,12 @@ declare module "location" {
startLocationMonitoring(onLocation: (location: Location) => any, onError?: (error: Error) => any, options?: Options);
/**
* Stops location monitoring
* Stops location monitoring.
*/
stopLocationMonitoring();
// other
/**
* Returns last known location from device's location services or null of no known last location
* Returns last known location from device's location services or null of no known last location.
*/
lastKnownLocation: Location;
}