Skip to content

Update pjax-standalone.js - #30

Open
jameswragg wants to merge 1 commit into
thybag:masterfrom
jameswragg:patch-1
Open

Update pjax-standalone.js#30
jameswragg wants to merge 1 commit into
thybag:masterfrom
jameswragg:patch-1

Conversation

@jameswragg

Copy link
Copy Markdown

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
Copy Markdown
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

thybag commented Oct 28, 2014

Copy link
Copy Markdown
Owner

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
Copy Markdown
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