Skip to content

expose initialize function for async and streaming use cases - #3953

Open
MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:init
Open

expose initialize function for async and streaming use cases#3953
MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:init

Conversation

@MichaelWest22

@MichaelWest22 MichaelWest22 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Description

For streaming use cases like my hx-streaming extension we need a way to get htmx to initialize its page handling and history support before domContentLoaded event fires. The ability to trigger htmx init has been a regular request before like in #2264 and many linked issues before.

Here i've made it a new public function so it can be called by anyone and it ensures history support is working and reprocesses the body to make sure it is live when you call it. We could move this function into internalAPI instead if we want to make it extension only instead.

Corresponding issue:
#2264

Testing

Added basic tests

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

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