← Back to context

Comment by kcrwfrd_

1 month ago

I've been working on a polyfill for the new Navigation API: https://github.com/kcrwfrd/navigation-ponyfill

I've been super hyped about it. My main goal at first was supporting `navigation.canGoBack` and the `currententrychange` event simply so that I could implement perfect back buttons with (almost) zero edge cases. This is surprisingly very tricky with the older History API.

Today I just opened a PR with support for `entries()` and `currentEntry`: https://github.com/kcrwfrd/navigation-ponyfill/pull/33

Once that lands I'll be able to start thinking about implementing full-blown navigations with it, with cool stuff like navigation interceptors and whatnot. That would actually enable framework router implementations wholly based off the Navigation API, rather than simply patching some enhanced capabilities for use with a router based on history.pushState / history.replaceState.