mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-20 01:22:52 +08:00
fix(plugin) only call clearFunction if defined. Fixes #210
This commit is contained in:
parent
11226d7d51
commit
28e2f731f7
@ -141,10 +141,12 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
|
||||
|
||||
return () => {
|
||||
try {
|
||||
if (opts.clearWithArgs) {
|
||||
return get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
|
||||
if (opts.clearFunction) {
|
||||
if (opts.clearWithArgs) {
|
||||
return get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
|
||||
}
|
||||
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
}
|
||||
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
|
||||
console.error(e);
|
||||
|
Loading…
Reference in New Issue
Block a user