Skip to content

onExit doesn't fire unless viewportSpy is enabled #275

@XuluWarrior

Description

@XuluWarrior

#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.

I would propose a change to the check on

if (!this.options.viewportSpy) {
to

if (!this.options.viewportSpy && !this.args.named.onExit) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions