feat(plugin): call clearFunction with original fn args

This commit is contained in:
Tim Lancina 2016-02-08 12:42:42 -06:00
parent 6688c4d91d
commit 8f27fc9e51
3 changed files with 7 additions and 1 deletions

View File

@ -95,6 +95,9 @@ function wrapObservable(pluginObj, methodName, args, opts) {
var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
return function () {
try {
if (opts.clearWithArgs) {
return util_1.get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
}
return util_1.get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, pluginResult);
}
catch (e) {

File diff suppressed because one or more lines are too long

View File

@ -106,6 +106,9 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any =
return () => {
try {
if (opts.clearWithArgs){
return get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
}
return get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, pluginResult);
} catch(e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);