Skip to content

Conversation

@thet
Copy link
Member

@thet thet commented Jan 7, 2025

Note: Not used in Patternslib yet but can be used like:

document.addEventListener("navigate", (e) => {
    console.log("url changed to: ", e.destination.url);
});

@thet thet changed the title Add polyfill for navigation API. Plus minor code improvements. Add polyfill for navigation API. Jan 7, 2025
@thet thet requested a review from petschki January 7, 2025 23:42
@thet thet force-pushed the navigate-event branch 7 times, most recently from 234a0ee to 2301c73 Compare January 16, 2025 00:29
This polyfill adds support for the "navigate" event on the navigation
object. We path "history.pushState" and "history.replaceState" to send
the "navigate" event on the "window.navigation" object when the URL
changes.

This polyfill is for current Firefox and Safari. Chrome based browsers
already support this.

More information on:
https://developer.mozilla.org/en-US/docs/Web/API/Navigation/navigate_event
@thet thet force-pushed the navigate-event branch from 2301c73 to b9c328f Compare April 4, 2025 23:59
@thet thet merged commit cde2a3a into master Apr 5, 2025
1 check passed
@thet thet deleted the navigate-event branch April 5, 2025 00:18
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