mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
parent
2c6cc37a5f
commit
d3e6f3ba41
@ -41,6 +41,11 @@ export const cordovaWarn = function(pluginName: string, method: string) {
|
||||
}
|
||||
};
|
||||
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
||||
// ignore resolve and reject in case sync
|
||||
if (opts.sync) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// If the plugin method expects myMethod(success, err, options)
|
||||
if (opts.callbackOrder === 'reverse') {
|
||||
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
||||
@ -77,10 +82,8 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
} else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
// which is 90% of cases
|
||||
if (!opts.sync) {
|
||||
args.push(resolve);
|
||||
args.push(reject);
|
||||
}
|
||||
args.push(resolve);
|
||||
args.push(reject);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user