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

Update pjax-standalone.js #30

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

Conversation

jameswragg
Copy link

I was hoping a reference to the clicked node was available in beforeSend (I wanted to add a class to the link) so added it here. Available in the event passed to beforeSend as e.data.node.

I was hoping a reference to the clicked node was available in beforeSend (I wanted to add a class to the link) so added it here. Available in the event passed to beforeSend as e.data.node.
@jameswragg
Copy link
Author

With hindsight, maybe pass the click event & options to beforeSend() and allow beforeSend to cancel the click/request. Use case: I provide a loading indicator (spinner) on a clicked pjax link and while the request is processing I want to prevent the user from clicking on more links, creating pjax requests to queue up.

@thybag
Copy link
Owner

thybag commented Oct 28, 2014

Hello,

Sorry about the slow response, I've merged this change (Along with some others) in to the develop branch https://github.com/thybag/PJAX-Standalone/tree/develop

I'll hopefully be able to have a look at rolling to master once i find time to do some proper testing on it all :)

@jameswragg
Copy link
Author

Hi, thanks for picking this up. Unfortunately I don't think my change is really the proper solution.

To explain: I need access to the clicked node in the beforeSend (all?) callback, but more importantly the beforeSend callback is currently a fired event rather than a function call that can potentially cancel the click event.
I think this is a much more useful behaviour & follows the jQuery ajax model with their beforeSend event ( see http://api.jquery.com/jquery.ajax/ )

I'd revert the merge of this PR & I'll look to refactor if this is still a maintained project?

James

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.

2 participants