mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-21 01:06:25 +08:00
fix(core): fix bug when checking if plugin exists (#1348)
* fix(cordova-plugin): add check if method exists For https://github.com/driftyco/ionic-native/issues/1327 * fix(plugin): add typeof to undefined check
This commit is contained in:
parent
f396940044
commit
4bd6aaba2b
@ -32,7 +32,7 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
|
|||||||
|
|
||||||
pluginInstance = getPlugin(pluginRef);
|
pluginInstance = getPlugin(pluginRef);
|
||||||
|
|
||||||
if (!pluginInstance || (!!methodName && pluginInstance[methodName] === 'undefined')) {
|
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
|
||||||
if (!window.cordova) {
|
if (!window.cordova) {
|
||||||
cordovaWarn(pluginName, methodName);
|
cordovaWarn(pluginName, methodName);
|
||||||
return {
|
return {
|
||||||
@ -54,7 +54,7 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export function instanceAvailability(pluginObj: any, methodName?: string): boolean {
|
export function instanceAvailability(pluginObj: any, methodName?: string): boolean {
|
||||||
return pluginObj._objectInstance && (!methodName || pluginObj._objectInstance[methodName] !== 'undefined');
|
return pluginObj._objectInstance && (!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user