mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-02 00:07:23 +08:00
🧈
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
@Plugin({
|
||||
name: 'Contacts',
|
||||
plugin: 'cordova-plugin-contacts',
|
||||
pluginRef: 'navigator.contacts',
|
||||
repo: 'https://github.com/apache/cordova-plugin-contacts'
|
||||
})
|
||||
export class Contacts {
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
// This method is create(fields, success, error, options) :/
|
||||
static create(fields:string[], options:any){};
|
||||
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static find(fields:string[], options:any){};
|
||||
|
||||
@Cordova()
|
||||
static pickContact(){};
|
||||
}
|
||||
@@ -50,8 +50,8 @@ export const wrap = function(pluginObj, methodName, opts: any = {}) {
|
||||
args[1] = reject;
|
||||
} else if(typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
// If we've specified a success/error index
|
||||
args[opts.successIndex] = resolve;
|
||||
args[opts.errorIndex] = reject;
|
||||
args.splice(opts.successIndex, resolve);
|
||||
args.splice(opts.errorIndex, reject);
|
||||
} else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
// which is 90% of cases
|
||||
|
||||
Reference in New Issue
Block a user