From b704d2875b396ffc750dd2df46cd81dfae12c207 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 14 Mar 2017 18:25:23 -0400 Subject: [PATCH] chore(decorators): do not check method name on instancecheck --- src/@ionic-native/core/decorators.ts | 2 +- src/@ionic-native/core/plugin.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/core/decorators.ts b/src/@ionic-native/core/decorators.ts index c6477cef8..07d6425e3 100644 --- a/src/@ionic-native/core/decorators.ts +++ b/src/@ionic-native/core/decorators.ts @@ -119,7 +119,7 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) { return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor => { return { value: function(...args: any[]): any { - if (instanceAvailability(pluginObj, methodName)) { + if (instanceAvailability(pluginObj)) { return descriptor.value.apply(this, args); } else { diff --git a/src/@ionic-native/core/plugin.ts b/src/@ionic-native/core/plugin.ts index 9344ec385..f7ae513ae 100644 --- a/src/@ionic-native/core/plugin.ts +++ b/src/@ionic-native/core/plugin.ts @@ -52,8 +52,8 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?: * Checks if _objectInstance exists and has the method/property * @private */ -export function instanceAvailability(pluginObj: any, methodName: string): boolean { - return pluginObj._objectInstance && pluginObj._objectInstance[methodName] !== 'undefined'; +export function instanceAvailability(pluginObj: any, methodName?: string): boolean { + return pluginObj._objectInstance && (!methodName || pluginObj._objectInstance[methodName] !== 'undefined'); } function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {