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

Listen to an event that fires before the AJAX call is made #279

Closed
bravokiloecho opened this issue May 24, 2018 · 4 comments
Closed

Listen to an event that fires before the AJAX call is made #279

bravokiloecho opened this issue May 24, 2018 · 4 comments

Comments

@bravokiloecho
Copy link

Is there currently a way to listen to an event that fires before any AJAX call is made? Something like:

Barba.Dispatcher.on('beforeLoad', function() {
  //your listener
});

If this doesn't exist, would it be possible to add it to this really useful library?

Many thanks!

@luruke
Copy link
Member

luruke commented Oct 15, 2018

Hello @bravokiloecho ,
what would be the usage of such event?

@luruke luruke closed this as completed Oct 15, 2018
@bravokiloecho
Copy link
Author

I needed this for a site where I was using cookies to paginate through a randomly sorted array of entries on wordpress. I needed to make a JS call to refresh cookies when a user left a certain page, but before the call to the server was made (via AJAX).

I actually added this functionality to a fork of this repo: bravokiloecho@67b54e2

@luruke
Copy link
Member

luruke commented Oct 15, 2018

Ok, i see @bravokiloecho .
I'll check if add such event in a new version.

@bravokiloecho
Copy link
Author

Brilliant, thanks @luruke!

I'm excited to hear there might be a new version. I use Barba.js a lot and find it really helpful. So many thanks for all your work on it!

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

No branches or pull requests

2 participants