Skip to content

Commit

Permalink
chore(comments): explain sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Jul 14, 2016
1 parent a1ce39d commit be1725d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function callInstance(pluginObj: any, methodName: string, args: any[], opts: any
function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callInstance(pluginObj, methodName, args, opts);
} else if (opts.observable) {
return new Observable(observer => {
Expand Down Expand Up @@ -190,6 +191,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}
return (...args) => {

if (opts.sync)
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callCordovaPlugin(pluginObj, methodName, args, opts);

else if (opts.observable)
Expand Down

0 comments on commit be1725d

Please sign in to comment.