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