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

45
camera/camera.d.ts vendored
View File

@@ -4,17 +4,41 @@ declare module "camera" {
import promises = require("promises"); import promises = require("promises");
import imageSource = require("image-source"); import imageSource = require("image-source");
/**
* Specifies a camera position on a device.
*/
enum CameraPosition { enum CameraPosition {
/**
* The camera is located at the front of the device, facing the user.
*/
FRONT = 0, FRONT = 0,
/**
* The camera is located at the back of the device.
*/
BACK = 1, BACK = 1,
} }
/**
* Specifies a camera flash mode.
*/
enum FlashMode { enum FlashMode {
AUTO = 0, // default /**
* Flash will be fired automatically when required.
*/
AUTO = 0,
/**
* The camera flash is enabled.
*/
ON = 1, ON = 1,
/**
* The camera flash is disabled.
*/
OFF = 2 OFF = 2
} }
/**
* Camera options for capture an image.
*/
interface Options { interface Options {
/** /**
* Specifies which Camera to use. * 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 // 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 { class CameraManager {
/**
* Take a photo using the camera.
*/
takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any); 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); 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>; function request(options: HttpRequestOptions): promises.Promise<HttpResponse>;
/**
* Provides options for the http requests.
*/
interface HttpRequestOptions { interface HttpRequestOptions {
/** /**
* Gets or sets the request url. * Gets or sets the request url.
@@ -71,42 +74,48 @@
timeout?: number; timeout?: number;
} }
/**
* Encapsulates HTTP-response information from an HTTP-request.
*/
interface HttpResponse { interface HttpResponse {
/** /**
* Gets the response status code. * Gets the response status code.
*/ */
statusCode: number; statusCode: number;
/** /**
* Gets the response headers. * Gets the response headers.
*/ */
headers: any; headers: any;
/** /**
* Gets the response content. * Gets the response content.
*/ */
content?: HttpContent; content?: HttpContent;
} }
/**
* Encapsulates the content of an HttpResponse.
*/
interface HttpContent { interface HttpContent {
/** /**
* Gets the response body as raw data. * Gets the response body as raw data.
*/ */
raw: any; raw: any;
/** /**
* Gets the response body as string. * Gets the response body as string.
*/ */
toString: () => string; toString: () => string;
/** /**
* Gets the response body as JSON object. * Gets the response body as JSON object.
*/ */
toJSON: () => any; toJSON: () => any;
/** /**
* Gets the response body as ImageSource. * Gets the response body as ImageSource.
*/ */
toImage: () => image.ImageSource; toImage: () => image.ImageSource;
} }
} }

View File

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

View File

@@ -2,10 +2,19 @@
declare module "location" { declare module "location" {
import promises = require("promises"); import promises = require("promises");
/**
* Specifies common accuracy values.
*/
enum Accuracy { enum Accuracy {
// in meters /**
ANY, * The default accuracy. About 300 meters.
HIGH, */
ANY = 300,
/**
* High accuracy. About 3 meters.
*/
HIGH = 3,
} }
// For future usage // For future usage
@@ -71,6 +80,9 @@ declare module "location" {
ios: CoreLocation.CLLocation; ios: CoreLocation.CLLocation;
} }
/**
* Provides options for location monitoring.
*/
export interface Options { export interface Options {
/** /**
* Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH
@@ -134,8 +146,6 @@ declare module "location" {
*/ */
isStarted: boolean; isStarted: boolean;
// monitoring
/** /**
* Starts location monitoring. * Starts location monitoring.
* @param onLocation A function that will be called upon every location update received. * @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); startLocationMonitoring(onLocation: (location: Location) => any, onError?: (error: Error) => any, options?: Options);
/** /**
* Stops location monitoring * Stops location monitoring.
*/ */
stopLocationMonitoring(); 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; lastKnownLocation: Location;
} }