docs(camera-preview): add usage

closes #363
This commit is contained in:
Ibrahim Hadeed 2016-09-06 23:12:35 -04:00
parent c75f89894a
commit 58c9439a32
No known key found for this signature in database
GPG Key ID: 0431793F665481A4

View File

@ -21,6 +21,52 @@ export interface CameraPreviewSize {
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
* @usage
* ```
* import { CameraPreview } from 'ionic-native';
*
* // camera options (Size and location)
* let cameraRect: CameraPreviewRect = {
* x: 100,
* y: 100,
* width: 200,
* height: 200
* };
*
*
* // start camera
* CameraPreview.startCamera(
* cameraRect, // position and size of preview
* 'front', // default camera
* true, // tape to take picture
* false, // disable drag
* true // send the preview to the back of the screen so we can add overlaying elements
* );
*
* // Set the handler to run every time we take a picture
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
* console.log(result);
* // do something with the result
* });
*
*
* // take a picture
* CameraPreview.takePicture({
* maxWidth: 640,
* maxHeight: 640
* });
*
* // Switch camera
* CameraPreview.switchCamera();
*
* // set color effect to negative
* CameraPreview.setColorEffect('negative');
*
* // Stop the camera preview
* CameraPreview.stopCamera();
*
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-camera-preview',
@ -42,9 +88,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void {
};
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { };
/**
* Stops the camera preview instance.