fix(decorators): fix InstanceCheck decorator

This commit is contained in:
Ibby
2017-03-14 20:08:22 -04:00
parent 4da9fab97e
commit 2b161bbbe0
2 changed files with 2 additions and 5 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) {
return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>): TypedPropertyDescriptor<any> => {
return {
value: function(...args: any[]): any {
if (instanceAvailability(pluginObj)) {
if (instanceAvailability(this)) {
return descriptor.value.apply(this, args);
} else {
@@ -111,10 +111,7 @@ export class GoogleMap {
*/
@InstanceCheck({ observable: true })
on(eventName: string): Observable<any> {
return new Observable((observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
});
return Observable.fromEvent(this._objectInstance, eventName);
}
/**