mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Updated the API reference.
This commit is contained in:
@@ -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
45
camera/camera.d.ts
vendored
@@ -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>;
|
||||
}
|
||||
|
||||
9
http/http.d.ts
vendored
9
http/http.d.ts
vendored
@@ -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,6 +74,9 @@
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates HTTP-response information from an HTTP-request.
|
||||
*/
|
||||
interface HttpResponse {
|
||||
/**
|
||||
* Gets the response status code.
|
||||
@@ -88,6 +94,9 @@
|
||||
content?: HttpContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates the content of an HttpResponse.
|
||||
*/
|
||||
interface HttpContent {
|
||||
/**
|
||||
* Gets the response body as raw data.
|
||||
|
||||
7
image-source/image-source.d.ts
vendored
7
image-source/image-source.d.ts
vendored
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
26
location/location.d.ts
vendored
26
location/location.d.ts
vendored
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user