fix(geofence): fix event listeners
This commit is contained in:
parent
abfa8a5f0f
commit
efa222fb55
@ -137,13 +137,11 @@ export class Geofence {
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static onTransitionReceived(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window.geofence.onTransitionReceived = observer.next.bind(observer);
|
||||
return null;
|
||||
// undefined can be replaced with ()=>{} .. whichever works better
|
||||
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||
return () => window.geofence.onTransitionReceived = () => {};
|
||||
});
|
||||
|
||||
}
|
||||
@ -154,13 +152,11 @@ export class Geofence {
|
||||
*
|
||||
* @return {Promise<Object>}
|
||||
*/
|
||||
@Cordova()
|
||||
static onNotificationClicked(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window.geofence.onNotificationClicked = observer.next.bind(observer);
|
||||
return () => window.geofence.onNotificationClicked = () => {}
|
||||
// undefined can be replaced with ()=>{} .. whichever works better
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||
return () => window.geofence.onNotificationClicked = () => {};
|
||||
});
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user