fix(alipay): adjust pay function properties (#3197)

* fix bug 'Success is not a function #158'
https://github.com/terikon/cordova-plugin-photo-library/issues/158

* alipay: add optional success, error callback
for pay()  method
This commit is contained in:
jing-zhou 2019-10-18 13:13:02 +08:00 committed by Daniel Sogl
parent 7033a1822e
commit fb5d47bff2
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
* constructor(private alipay: Alipay) { * constructor(private alipay: Alipay) {
* *
* //alipayOrder is a string that has been generated and signed by the server side. * //alipayOrder is a string that has been generated and signed by the server side.
* this.alipay.pay(alipayOrder) * this.alipay.pay(alipayOrder, success, error)
* .then(result => { * .then(result => {
* console.log(result); // Success * console.log(result); // Success
* }) * })
@ -44,7 +44,7 @@ export class Alipay extends IonicNativePlugin {
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error. * @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
*/ */
@Cordova() @Cordova()
pay(order: string): Promise<any> { pay(order: string, success?: (res?: any) => void, error?: (err?: any) => void): Promise<any> {
return; return;
} }
} }

View File

@ -125,7 +125,7 @@ export class PhotoLibrary extends IonicNativePlugin {
@Cordova({ @Cordova({
observable: true observable: true
}) })
getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> { getLibrary(success?: (res?: any) => void, error?: (err?: any) => void, options?: GetLibraryOptions): Observable<LibraryItem[]> {
return; return;
} }