Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Page load and Scroll end Events #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adearriba
Copy link

Sorry if this is not a great PR. It is the first I've done for public projects.

I added 2 events that extend the flexibility of the library:

  • ajaxinate.page:load : This event fires when a new page is loaded.
  • ajaxinate.scroll:end : This event fires when there is no more pages left to load.

I've had to add those in my code since the callback forces me to handle everything in 1 place instead of being able to handle different things in different places of the code.

Hope it helps the project.

Best,
@adearriba

@adearriba
Copy link
Author

The way to use these new events would be:

document.addEventListener('ajaxinate.page:load', event => {
    //event.detail.content contains the HTML element being added
    console.log(event.detail.content);
});
document.addEventListener('ajaxinate.scroll:end', event => {
    console.log('No more pages left');
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant