CameraRoll docs

This commit is contained in:
Max Lynch
2015-09-28 12:30:15 -05:00
parent 85d2b41926
commit a6fb4ba15d

View File

@ -4,7 +4,15 @@ import * as util from 'ionic/util';
import {NativePlugin} from '../plugin';
/**
* Save and load photos from the Camera Roll
* Save and load photos from the Camera Roll (currently iOS only).
*
* Requires the Cordiva plugin `cordova-plugin-camera-roll`
*
* @usage
* ```js
* CameraRoll.save(base64EncodedImage).then(() => {
* // success
* }, (err) => {})
*/
@NativePlugin({
name: 'CameraRoll',
@ -19,6 +27,9 @@ import {NativePlugin} from '../plugin';
export class CameraRoll {
/**
* Save the base64 encoded image to the camera roll.
*
* @param base64String {String} base-64 encoded image
* @return {Promise}
*/
static save(base64String) {
return new Promise((resolve, reject) => {
@ -33,12 +44,14 @@ export class CameraRoll {
}
/**
* Get photos from the camera roll
* Get photos from the camera roll.
*/
static getPhotos(options) {
return new Promise((resolve, reject) => {
this.ifPlugin(() => {
window.CameraRoll.saveToCameraRoll(base64String);
window.CameraRoll.getPhotos((photos) => {
resolve(photos);
});
})
});
}