docs(nfc): enhance docs (#1325)

labeled methods with classes, improved method descriptions
This commit is contained in:
Garry-H 2017-04-14 07:58:53 -05:00 committed by Ibby Hadeed
parent 620289f54b
commit caec80b661

View File

@ -34,6 +34,9 @@ declare let window: any;
pluginRef: 'nfc', pluginRef: 'nfc',
repo: 'https://github.com/chariotsolutions/phonegap-nfc' repo: 'https://github.com/chariotsolutions/phonegap-nfc'
}) })
/**
*@{ NFC } class methods
*/
@Injectable() @Injectable()
export class NFC { export class NFC {
/** /**
@ -96,7 +99,7 @@ export class NFC {
addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; } addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
/** /**
* Qrites an NdefMessage to a NFC tag. * Writes an NdefMessage(array of ndef records) to a NFC tag.
* @param message {any[]} * @param message {any[]}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@ -110,7 +113,7 @@ export class NFC {
makeReadyOnly(): Promise<any> {return; } makeReadyOnly(): Promise<any> {return; }
/** /**
* Shares an NDEF Message via peer-to-peer. * Shares an NDEF Message(array of ndef records) via peer-to-peer.
* @param message An array of NDEF Records. * @param message An array of NDEF Records.
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@ -146,7 +149,7 @@ export class NFC {
stopHandover(): Promise<any> {return; } stopHandover(): Promise<any> {return; }
/** /**
* Show the NFC settings on the device. * Opens the device's NFC settings.
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
@ -159,21 +162,26 @@ export class NFC {
@Cordova() @Cordova()
enabled(): Promise<any> {return; } enabled(): Promise<any> {return; }
/** /**
* Convert bytes to string * @{ NFC } class utility methods
* for use with
*/
/**
* Convert byte array to string
* @param bytes {number[]} * @param bytes {number[]}
* @returns {string} * @returns {string}
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
bytesToString(bytes: number[]): string {return; } bytesToString(bytes: number[]): string {return; }
/** /**
* Convert string to bytes * Convert string to byte array.
* @param str {string} * @param str {string}
* @returns {number[]} * @returns {number[]}
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
stringToBytes(str: string): number[] {return; }; stringToBytes(str: string): number[] {return; };
/** /**
* Convert bytes to hex string * Convert byte array to hex string
*
* @param bytes {number[]} * @param bytes {number[]}
* @returns {string} * @returns {string}
*/ */
@ -189,6 +197,14 @@ export class NFC {
plugin: 'phonegap-nfc', plugin: 'phonegap-nfc',
pluginRef: 'ndef' pluginRef: 'ndef'
}) })
/**
*@{ Ndef } class methods
*@description
* Utility methods for creating ndef records for the ndef tag format.
* Move records into array before usage. Then pass an array to methods as parameters.
* Do not pass bytes as parameters for these methods, conversion is built in.
* For usage with nfc.write() and nfc.share()
*/
@Injectable() @Injectable()
export class Ndef { export class Ndef {