270 added the viewportSpy option which means that if it is disabled, after onEnter, stopWatching is called.
This makes sense if you're only considering onEnter but if onExit is defined, then it is counterintuitive that it never gets called unless viewportSpy is set to true.
It took me a while to realise why {{in-viewport onEnter=this.onEnter onExit=this.onExit}} only called my onEnter handler.
270 added the
viewportSpy
option which means that if it is disabled, afteronEnter
,stopWatching
is called.This makes sense if you're only considering
onEnter
but ifonExit
is defined, then it is counterintuitive that it never gets called unlessviewportSpy
is set to true.It took me a while to realise why
{{in-viewport onEnter=this.onEnter onExit=this.onExit}}
only called myonEnter
handler.I would propose a change to the check on https://github.com/DockYard/ember-in-viewport/blob/e052a89b7a0322d21aec69b9e6e3f7c08bf5bfd2/addon/modifiers/in-viewport.js#L45 to