mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-07-16 00:00:04 +08:00
fix(decorators): fix InstanceCheck decorator
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user