From ecbe5faef8efd68491ce048f7335106ffe2adef2 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 11 Aug 2016 07:55:26 -0400 Subject: [PATCH] docs(): add missing docs --- src/plugins/emailcomposer.ts | 1 + src/plugins/httpd.ts | 16 +++++++++++++++- src/plugins/printer.ts | 22 ++++++++++++++++++++-- src/plugins/screenshot.ts | 15 ++++++++++++++- src/plugins/twitter-connect.ts | 21 ++++++++++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts index 82fa266da..c1cdddd1b 100644 --- a/src/plugins/emailcomposer.ts +++ b/src/plugins/emailcomposer.ts @@ -10,6 +10,7 @@ declare var cordova: any; * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer). * * DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version. + * A good alternative to this plugin is the social sharing plugin. * * @usage * ```typescript diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index 3aa5fed25..5d11b3941 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -7,6 +7,20 @@ import { Observable } from 'rxjs/Observable'; * @description * Embedded httpd for Cordova apps. Light weight HTTP server. * @usage + * ```typescript + * import {Httpd, HttpdOptions} from 'ionic-native'; + * + * let options: HttpdOptions = { + * www_root: 'httpd_root', // relative path to app's www directory + * port: 80, + * localhost_only: false + * }; + * + * Httpd.startServer(options).subscribe((data) => { + * console.log('Server is live'); + * }); + * + * ``` */ @Plugin({ plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', @@ -25,7 +39,7 @@ export class Httpd { observable: true, clearFunction: 'stopServer' }) - static startServer(options: any): Observable { return; } + static startServer(options?: any): Observable { return; } /** * Gets the URL of the running server diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts index 93aa5b8c1..43ae62f20 100644 --- a/src/plugins/printer.ts +++ b/src/plugins/printer.ts @@ -40,8 +40,26 @@ export interface PrintOptions { */ bounds?: number[] | any; } - - +/** + * @name Printer + * @description Prints documents or HTML rendered content + * @usage + * ```typescript + * import {Printer, PrintOptions} from 'ionic-native'; + * + * Printer.isAvailable().then(onSuccess, onError); + * + * let options: PrintOptions = { + * name: 'MyDocument', + * printerId: 'printer007', + * duplex: true, + * landscape: true, + * grayscale: true + * }; + * + * Printer.print(content, options).then(onSuccess, onError); + * ``` + */ @Plugin({ plugin: 'de.appplant.cordova.plugin.printer', pluginRef: 'cordova.plugins.printer', diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index a712151b6..e23e87f5d 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -2,7 +2,20 @@ import { Cordova, Plugin } from './plugin'; declare var navigator: any; - +/** + * @name Screenshot + * @description Captures a screen shot + * @usage + * ```typescript + * import {Screenshot} from 'ionic-native'; + * + * // Take a screenshot and save to file + * Screneshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError); + * + * // Take a screenshot and get temporary file URI + * Screneshot.URI(80).then(onSuccess, onError); + * ``` + */ @Plugin({ plugin: 'https://github.com/gitawego/cordova-screenshot.git', pluginRef: 'navigator.screenshot', diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index c0d453ef2..aee4480c4 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -6,11 +6,30 @@ import { Plugin, Cordova } from './plugin'; * @description * Plugin to use Twitter Single Sign On * Uses Twitter's Fabric SDK + * ```typescript + * import {TwitterConnect} from 'ionic-native'; + * + * function onSuccess(response) { + * console.log(response); + * + * // Will console log something like: + * // { + * // userName: 'myuser', + * // userId: '12358102', + * // secret: 'tokenSecret' + * // token: 'accessTokenHere' + * // } + * } + * + * TwitterConnect.login().then(onSuccess, onError); + * + * TwitterConnect.logout().then(onLogoutSuccess, onLogoutError); + * ``` */ @Plugin({ plugin: 'twitter-connect-plugin', pluginRef: 'TwitterConnect', - repo: '', + repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin', install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key' }) export class TwitterConnect {