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

Support hooks #177

Merged
merged 5 commits into from
Sep 30, 2021
Merged

Support hooks #177

merged 5 commits into from
Sep 30, 2021

Conversation

PaperStrike
Copy link
Owner

@PaperStrike PaperStrike commented Sep 27, 2021

Motivation and Context

With hooks, you can now change the request, response, parsed document (of type Document), and DOM switchesResult (of type SwitchesResult) used inside Pjax.

Inspired by falsandtru's sequence option.
Thanks to @Yahav for the introduction.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (no bug fix and new feature but improvements)

Checklist:

  • My change requires new tests.
  • I have added tests to cover my changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@PaperStrike PaperStrike added enhancement New feature or request minor Pull requests that require a minor version update labels Sep 27, 2021
@Yahav
Copy link
Contributor

Yahav commented Sep 27, 2021

How about a hook after the blocking javascript is done executing as well?

@PaperStrike
Copy link
Owner Author

How about a hook after the blocking javascript is done executing as well?

Could you please give me some use cases for this?

@PaperStrike
Copy link
Owner Author

This package not only cares about the functionalities, but being small and compliant with the standard. There isn't an event for something like "all script initial execution done" in the initial page load, maybe it's for security or it's simply meaningless, so I prefer not to have it as for now (load event is a different case as it indicates all the resources). So if you could provide a reasonable use case for this, that would really help.

@Yahav
Copy link
Contributor

Yahav commented Sep 27, 2021

Well, in my case i would use it to register some components, which i can do only once they have finished initializing themselves.
But i see your point, i might need to fire some events from within those scripts for this kind of functionality.

@Yahav
Copy link
Contributor

Yahav commented Sep 30, 2021

Can you please merge this?

@PaperStrike PaperStrike merged commit 605d328 into main Sep 30, 2021
@PaperStrike PaperStrike deleted the intro-hooks branch September 30, 2021 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Pull requests that require a minor version update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants