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 {
|
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 the plugin method expects myMethod(success, err, options)
|
||||||
if (opts.callbackOrder === 'reverse') {
|
if (opts.callbackOrder === 'reverse') {
|
||||||
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
||||||
@ -77,10 +82,8 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
|||||||
} else {
|
} else {
|
||||||
// Otherwise, let's tack them on to the end of the argument list
|
// Otherwise, let's tack them on to the end of the argument list
|
||||||
// which is 90% of cases
|
// which is 90% of cases
|
||||||
if (!opts.sync) {
|
args.push(resolve);
|
||||||
args.push(resolve);
|
args.push(reject);
|
||||||
args.push(reject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user