I'm listening to a deviceorientationabsolute
event like this (on ngOnInit
):
this.deviceOrientationEvent = this.onDeviceOrientation.bind(this);
window.addEventListener("deviceorientationabsolute", this.deviceOrientationEvent);
I want to stop listening to that event on ngOnDestroy
. I tried this:
window.removeEventListener("deviceorientationabsolute", this.deviceOrientationEvent);
But I can still see in the console that it's listening to the event.
What am I doing wrong?