diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index fb02c563..ec11b3cd 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -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; }