docs(TouchID): Improves formatting of usage docs (#397)

* Fixes syntax error in usage example, and improves usage formatting

* Moves error codes into usage section
This commit is contained in:
Alex Muramoto 2016-08-04 14:58:35 -07:00 committed by Ibrahim Hadeed
parent cabeeb8dab
commit 225a44ca4d

View File

@ -8,6 +8,29 @@ import { Cordova, Plugin } from './plugin';
* *
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id). * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
* *
* @usage
* ### Import Touch ID Plugin into Project
* ```typescript
* import { TouchID } from 'ionic-native';
* ```
* ### Check for Touch ID Availability
* ```typescript
* TouchID.isAvailable()
* .then(
* res => console.log('TouchID is available!'),
* err => console.error('TouchID is not available', err)
* );
* ```
* ### Invoke Touch ID w/ Custom Message
*
* ```typescript
* TouchID.verifyFingerprint('Scan your fingerprint please')
* .then(
* res => console.log('Ok', res),
* err => console.error('Error', err)
* );
* ```
*
* ### Error Codes * ### Error Codes
* *
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently. * The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
@ -20,23 +43,6 @@ import { Cordova, Plugin } from './plugin';
* - `-4` - The scan was cancelled by the system (Home button for example) * - `-4` - The scan was cancelled by the system (Home button for example)
* - `-6` - TouchID is not Available * - `-6` - TouchID is not Available
* - `-8` - TouchID is locked out from too many tries * - `-8` - TouchID is locked out from too many tries
* @usage
* ```typescript
* import { TouchID } from 'ionic-native';
*
*
* TouchID.isAvailable()
* .then(
* res => console.log('TouchID is available!'),
* err => console.error("TouchID isn't available", err)
* );
*
* TouchID.verifyFingerprint('Scan your fingerprint please')
* .then(
* res => console.log('Ok', res),
* err => console.error('Error', err)
* );
* ```
*/ */
@Plugin({ @Plugin({
plugin: 'cordova-plugin-touch-id', plugin: 'cordova-plugin-touch-id',
@ -47,7 +53,7 @@ import { Cordova, Plugin } from './plugin';
export class TouchID { export class TouchID {
/** /**
* Whether TouchID is available or not. * Checks Whether TouchID is available or not.
* *
* @return {Promise} Returns a Promise that resolves if yes, rejects if no. * @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/ */